I have a script that allows me to login a user without a password, having had integrated an SSO into my vbulletin, i'm using criteria from the SSO to secure the process for signing on. However, when I get redirected to the forum, it looks like the user is Logged on and their name is in the top corner and the page looks correct, the user tries to navigate somewhere on the page then is told that the user is not logged on. I'm at a loss for what is going on. Need some help reviewing the code please.
PHP Code:
class vBulletinUser{
public static function login($username, $remember_me = true){
//chdir(VB_ROOT_PATH); //not required, file is in my forum directory
//require_once('./global.php'); //already at the top of hte page
//require_once(DIR . '/includes/functions_login.php'); //already at the top of hte page
global $vbulletin,$vbphrase;
$remember_me = $remember_me ? true : false; //force to true or false value
$vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids,
username, password, salt FROM ".TABLE_PREFIX."user WHERE username = '".
$vbulletin->db->escape_string(htmlspecialchars_uni($username))."'");
if ($vbulletin->userinfo){
set_authentication_cookies(true);
process_new_login($vbulletin->GPC['logintype'], $remember_me, $vbulletin->GPC['cssprefs']);
exec_shut_down();
$vbulletin->url = '/index.php';
header('Location: /');
return true;
}
return false;
}
}
I'm invoking the class by:
PHP Code:
$vb = new vBulletinUser();
$vb->login($_SESSION['charName']);
* The charName is infact present.
I could greatly use some help as to figure out why it shows it like its logged on, but as soon as you navigate away, it says its not logged on.