vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Help with php! (https://vborg.vbsupport.ru/showthread.php?t=318381)

Duckface 04-23-2015 01:16 PM

Help with php!
 
Hiya,

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

Code:

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

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

Code:

{includephp}
Within the template, I have this when you click the 'Upgrade Now' button:
Code:

<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:
Code:

{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:

Code:

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

Duckface 04-23-2015 01:24 PM

Quote:

Originally Posted by kh99 (Post 2543961)
The first one should be this:
Code:

{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:

Code:

<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:
PHP Code:

include('donate/donate.php'); 


Duckface 04-23-2015 01:41 PM

Quote:

Originally Posted by NickTheGreek (Post 2543963)
If your vBulletin is on /forum/ directory, then I think that the include must be:
PHP Code:

include('donate/donate.php'); 


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

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

PHP Code:

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


TheAdminMarket 04-23-2015 02:50 PM

1 Attachment(s)
Quote:

Originally Posted by Duckface (Post 2543965)
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

Quote:

Originally Posted by NickTheGreek (Post 2543971)
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 :).


All times are GMT. The time now is 09:02 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01170 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (3)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete