PDA

View Full Version : Examples


srcnix
06-20-2007, 09:22 AM
Hi all,

Just wondering if anyone would be able to post some example code for checking if a user is logged in.

I've not too much experience in PHP OOP but am happy to learn from examples.

Cheers.

Dismounted
06-20-2007, 09:27 AM
require_once('./global.php');

if ($vbulletin->userinfo['userid'] == 0)
{
// Not Logged In
}

srcnix
06-20-2007, 09:33 AM
require_once('./global.php');

if ($vbulletin->userinfo['userid'] == 0)
{
// Not Logged In
}

That's pretty much what I had to mind.

Does vB not have a specific function for checking if a user is logged in then?

ragtek
06-20-2007, 09:38 AM
you can use
$show['guest']
$show['member']

srcnix
06-20-2007, 09:44 AM
ragtek, I'm guessing I need to include global.php and would use the above like:


if($show['guest']) {
// Show guest data
} else if($show['member']) {
// Show member data
}


Where is $show defined?

Found it ;) And yeah, I was right ;)

ZomgStuff
06-21-2007, 07:37 PM
Thanks, really helpful!