PDA

View Full Version : can't get sessions outside of vbulletin


bradthor
12-25-2015, 07:23 PM
I am trying to get vbulletin session variables eg: userID and username from an external page/file in the parent directory of vbulletin.
I have followed the steps suggested for this process as follows.
first i declare



<?php global $vbulletin; ?>

then I include global.php with the following code.

<?php
$savedir = getcwd();
chdir('/home/base/public_html/forum/');
include('global.php');
chdir($savdir);
?>

i would then echo data like the following code

<?php echo $vbulletin->userinfo['username']; ?>

This works perfectly inside the vbulletin directory however it returns Unregistered forusername and 0 for userid.

I have checked that
1.Path to Save Cookies set to "Suggested Settings '/' "
2.$bbuserinfo['userid'] doesnt work
3.$vbulletin->userinfo['userid'] and $vbulletin->userinfo['username'] return 0 and Unregistered respectively
4.code is correct for vbulletin version 4.2.3 as suggested

Can anyone advise me how to correctly get the vbulletin session variables(userid and username)/$vbulletin->userinfo array of the current logged in user in an external directory to the vbulletin installation.
Please feel free to ask for any additional info.
Thanks a ton:).

bradthor
12-27-2015, 08:49 PM
fixed it ... something wrong with the cookies on my computer,I creared browsing history and now it works