PDA

View Full Version : Is User Logged In?


core_basic
09-29-2011, 06:17 PM
Hello. I have a page outside of my vbulletin directory, and im trying to see if users are logged in, and if so to dispay some infornmation.

Is there something wrong with the code below? I just can't figure it out!

<?
$curdir = getcwd();
chdir('./forums/');
require_once('global.php');
chdir($curdir);

if (!empty($vbulletin->userinfo['userid']))
{
// if logged in
}
else
{
// if not logged in
}

?>

kh99
09-29-2011, 06:29 PM
In the adminCP, under Settings -> Options -> Cookies and HTTP Header Options -> Path to Save Cookies, make sure it's set to '/', otherwise the cookie won't be sent and it won't look like the user is logged in.

Other than that the above code seems OK to me.

core_basic
09-29-2011, 06:32 PM
It works, thanks.