Back to vBulletin 3 Articles

See who is logged in outside of vBulletin
by nabeel 21 Jul 2002

PHP Code:
//PUT THIS AS THE VERY FIRST THING ON YOUR PAGE, BEFORE THE <html> TAG<?
                
include_once("forums\\admin\\config.php");
    include_once(
"forums\\admin\\db_mysql.php");
    
$DB_site=new DB_Sql_vb;
    
$DB_site->appname='vBulletin';
    
$DB_site->appshortname='vBulletin (forum)';
    
$DB_site->database=$dbname
    $DB_site
->server=$servername;
    
$DB_site->user=$dbusername;
    
$DB_site->password=$dbpassword;
    
$DB_site->connect();

    include(
"forums\\admin\\functions.php");
    include(
"forums\\admin\\sessions.php");
?>

<?
//now you can check who is logged in, this can go anywhere
if($bbuserinfo['userid'] != 0){
        echo 
"welcome " $bbuserinfo['username'] . "<br>your user id is: " $bbuserinfo['userid'];
    }
?>

this could be used if you want to make sure someone is logged in before they come to your site, or a customized home page showing their info

vblts.ru supports vBulletin®, 2022-2024