vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Integration of Vbulletin in website causing errors (https://vborg.vbsupport.ru/showthread.php?t=182552)

Fulla 06-15-2008 10:48 AM

Integration of Vbulletin in website causing errors
 
Integrating Vbulletin functions into my website is causing me problems.

If I include the following in my script:
<?php
//Begin Define $rootdir
$times=substr_count($_SERVER['PHP_SELF'],'/');
$rootdir='';
$x=1;
while ($x < $times) {$rootdir .= "../";$x++;}
$GLOBALS['rootdir']=$rootdir;
//End Define $rootdir

define('DIR',$rootdir.'board/');
define('CWD',$rootdir.'board/');
require_once(DIR.'global.php'); //these 4 files all (also separate) cause this problem
require_once(DIR.'includes/functions_bigthree.php'); //these 4 files all (also separate) cause this problem
require_once(DIR.'includes/class_postbit.php'); //these 4 files all (also separate) cause this problem
require_once(DIR.'includes/class_bbcode.php'); //these 4 files all (also separate) cause this problem
?>

Once I require a file from Vbulletin, all my vars are wiped.
If I open the page as followed: myfile.php?page=test
Then the following scripts give the following response

<?php
$pagina=$_GET['page']

echo $pagina; //test

//vbinclude

echo $pagina; //empty
?>

<?php
$pagina='about';
$pagina=$_GET['page'};

echo $pagina; //test

//vbinclude

echo $pagina; // empty
?>

<?php
$pagina='about';

echo $pagina; //about

//vbinclude

echo $pagina; //about
?>

So it doesn’t really wipe out the $vars, altho vars filled with $_GET’s are wiped.

What is causing this, and how can I solve this?

I put this in my php.ini: register_globals = off

thx for any help

Opserty 06-15-2008 02:34 PM

Include global.php at the begging of your script. and use chdir().

Like this:

PHP Code:

<?php
$cwd 
getcwd(); // Save our current directory to switch to after
chdir('path/to/forum');
require_once(
'global.php')
// more require_once()
chdir($cwd// Switch back to original directory

// Continue script...


MoT3rror 06-15-2008 05:38 PM

vBulletin destroys most variables when it is included. If you define the variables as a constant, vbulletin will keep this value.

I suggest if you are going to use superglobals such as $_GET, $_POST, $_REQUEST, etc. to use the vBulletin Input Cleaner.


All times are GMT. The time now is 05:06 AM.

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.01641 seconds
  • Memory Usage 1,718KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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