Support Forums
vbulletin / php question? - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Webmaster Support (https://www.supportforums.net/forumdisplay.php?fid=36)
+---- Forum: Forum Software Help (https://www.supportforums.net/forumdisplay.php?fid=49)
+---- Thread: vbulletin / php question? (/showthread.php?tid=12824)



vbulletin / php question? - DAMINK™ - 10-16-2010

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.


RE: vbulletin / php question? - Omniscient - 10-17-2010

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']


RE: vbulletin / php question? - DAMINK™ - 10-17-2010

(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.