简体   繁体   中英

How can I get the userid on a vbulletin forum using global.php on a page outside of the forum?

This is what I tried:

<?php chdir('forum');
include('global.php');
?>

This is the only thing that gave some results and I had to place it as the first line in the php file otherwise I would get some cookie error.

But the problem is that when I do an echo $vbulletin->userinfo['userid']; it comes out 0 even if I'm logged in and an echo for the username is Unregistered.

How can I make this work when the user is logged in ?

I used the JQuery function .post() to call a php script inside the forum folder that would gather the data I needed and returned it. This way I didn't even need to use php on my page. It's a great solution for those who need it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM