Support Forums

Full Version: vbulletin / php question?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok guys and gals.
I have a VB forum as some of you are aware.
Now i want to be able to put custom scripts in my forum but still call up the global.php file to make sure the user is logged in in order to see the contents.
Thats simple enough to do.
I just use the below code.
PHP Code:
<?php 
require_once('./global.php'); 
if (
$vbulletin->userinfo['userid']!=0) {
  echo 
"Welcome Back, <b>"
  echo 
$vbulletin->userinfo['username'];  
  } else {
  echo 
"Sorry No Joy, <b>";
  }
 
?>

Now that works fine from the root.
But if i try this in a directory i get errors.
Obviously i have to point to ../global.php?
Well when i try that i get further errors?
It detects the global just fine but it trips up with a bootstrap hook in the global.php file. I assume because it does not know where it is?
Im sure its a simple answer but its got me buggered.
I tried to define the root path also
Code:
define( ROOT_PATH , "./" );
and no luck still!

Any help would be appreciated thanks all.
VB Should have definition for script path.

For MyBB it's MYBB_ROOT

You can also try using a global like $_SERVER['PATH_INFO'] or $_SERVER['DOCUMENT_ROOT']
(10-17-2010, 11:08 AM)Omniscient Wrote: [ -> ]VB Should have definition for script path.

For MyBB it's MYBB_ROOT

You can also try using a global like $_SERVER['PATH_INFO'] or $_SERVER['DOCUMENT_ROOT']

Yep thats exactly the way i ended up going. However for some reason that did not work.
I did use the chdir option and that seemed to fix it.
Thanks for your help Omni.