PDA

View Full Version : Access $vbulletin when in different directory


myHybridcar.com
02-14-2009, 06:41 PM
I'm attempting to access $vbulletin when outside the forum directory. The following code works when the user is logged in, but for some reason if the user is not logged in the script starts outputting HTML as if I were loading a forum page. What's going on? Thanks :)

// check if logged in
if (!$vbulletin)
{
$phrasegroups = array();
$specialtemplates = array();
$globaltemplates = array();
$actiontemplates = array();
$cwd = getcwd();
chdir ('/home/myhybrid/www/forums/');
require_once('./global.php');
global $vbulletin;
chdir ($cwd);
}

// if not logged in, show login form
if (!$vbulletin->userinfo['userid'])
{
// show login form
}

TigerC10
02-15-2009, 05:24 AM
What are you trying to do? Why do you need to change the working directory?

myHybridcar.com
02-15-2009, 03:27 PM
I want to utilize the vBulletin login system from a custom application I'm developing.

ForumsMods
02-15-2009, 03:32 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=173698" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=173698</a>

myHybridcar.com
02-15-2009, 03:52 PM
Thanks. And I think I actually figured out my problem—I had a code include inside my header template.