PDA

View Full Version : Help with php!


Duckface
04-23-2015, 01:16 PM
Hiya,

I've allowed the use of includingphp into the templates by adding this as a plugin hook in the global_start:

ob_start();
include('/forums/donate/donate.php');
$includedphp = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('Donate',array('php_inclu de' => $php_include));

And I've added this to the custom page 'Donate' (template):


{includephp}


Within the template, I have this when you click the 'Upgrade Now' button:

<form name="upgrade" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

However, when the button is clicked, the php isn't recognized and it opens literally a link with the output:


https://vborg.vbsupport.ru/external/2015/04/6.png


Link:
http://spawnscape614.co.uk/forums/donate/donate.php

How can I get the php to be recognized?

kh99
04-23-2015, 01:22 PM
The first one should be this:
{vb:raw includephp}

but you didn't say that it didn't work, so maybe it's just a typo? Anyway, for the second, try this:

<form name="upgrade" method="post" action="{vb:raw _SERVER.PHP_SELF}">

Duckface
04-23-2015, 01:24 PM
The first one should be this:
{vb:raw includephp}

but you didn't say that it didn't work, so maybe it's just a typo? Anyway, for the second, try this:

<form name="upgrade" method="post" action="{vb:raw _SERVER.PHP_SELF}">

Oh, typo haha. I added a d. So sorry for wasting your time. Thanks!

TheAdminMarket
04-23-2015, 01:26 PM
If your vBulletin is on /forum/ directory, then I think that the include must be:

include('donate/donate.php');

Duckface
04-23-2015, 01:41 PM
If your vBulletin is on /forum/ directory, then I think that the include must be:

include('donate/donate.php');


Yes, it's solved now but thanks for helping.

For clarification I already had this in my donate.php:

chdir('./../');
require_once('./global.php');

TheAdminMarket
04-23-2015, 02:50 PM
For clarification I already had this in my donate.php:


Just curious. Why you don't use any free plugin for Donations? If you want give a try with it. I've removed it from here as I don't have time for support but it works fine.

Duckface
04-23-2015, 08:25 PM
Just curious. Why you don't use any free plugin for Donations? If you want give a try with it. I've removed it from here as I don't have time for support but it works fine.

Because I want to get some basic php and javascript knowledge :).