Hi,
I have a site what has a vbuletin forum. The site has an users section and I want to connect it with the vbulletin one.
I managed to create users successfuly ( by creating my own library after studying the VB code ).
I got stuck in forcing a login for forum. I want when an user loggins in the site automaticaly to be logged in the forum too. I need to to this directly from the phpcode not using hidden iframes .
I'm creating the records for the session in the database, but even i set the cookie, when i refresh the forum pages, my cookie gets overwritten with one created by the forum.
PHP Code:
function UserLoginSession($username){
$user = $this->UserGet($username);
//do a check for existing sessions
$session = array(
"sessionhash" => md5(time()),
"userid" => $user["userid"],
"host" => $_SERVER["REMOTE_ADDR"],
"idhash" => md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER["REMOTE_ADDR"]),
"lastactivity" => time(),
"location" => "/",
"useragent" => $_SERVER['HTTP_USER_AGENT'],
"styleid" => 0,
"languageid" => 0,
"loggedin" => 1,
"inforum" => 0,
"inthread" => 0,
"incalendar" => 0,
"badlocation" => 0,
"bypass" => 0,
"profileupdate" => 0
);
//save the session into the table
$this->db->QueryInsert(
$this->private->tables["sessions"],
$session
);
//delete the existing cookie
setcookie("bbsessionhash", "" , time() - 24 * 3600 * 3);
setcookie("bblastactivity", "" , time() - 24 * 3600 * 3);
//update the cookies informations
setcookie("bbsessionhash", $session["sessionhash"] , time() + 24 * 3600 * 365);
setcookie("bblastvisit", time() , time() + 24 * 3600 * 365);
return true;
}
Anyone has any suggestion or you know any 3rdparty libraries which can habdle this successfuly ?
Thanks,
Emanuel
Reply With Quote