Are you already including vbulletin's global.php in your external pages? If so, you just need to check for $vbulletin->userinfo['userid'] != 0, which will only be true for logged in users.
If you're not including global.php, you need to do that. The "current working directory" needs to be your forum directory (the directory that has global.php) for the include to work. So if that isn't where your external script is located, you would need to chdir() to it before the include and maybe chdir() back to the original directory if other things in your script depend on it.
Also, if your external script isn't in the vb forum directory, then for that to work your vbulletin cookie path needs to be set '/' (which I believe is the default), otherwise the vb cookies won't be sent and users won't appear logged in.
To be honest I think including global.php does more than you need to do just to check if the user is logged in. I think I remember reading a thread where someone had managed to include the file includes/init.php, which will do less unnecessary work, but I can't remember what needs to be done for that to work.
|