jamescrf
Thu 18th Dec '03, 10:04pm
Any help would be greatly appreciated. I have a front end subscription script that members login with - then they click to enter the vb3 members area - at this point the code below should set the appropreiate cookies so that the member does not have to log in twice. Well it currently requires them to login twice.
Code:
$this_config = $plugin_config['protect']['vbulletin3'];
$vb_db = $this_config['db'];
$user_login = $db->escape($user['login']);
$q = $db->query("SELECT username, password, userid, salt
FROM ${vb_db}user
WHERE username = '$user_login' ");
list($username, $password, $userid, $salt) = mysql_fetch_row($q);
if (($userid>0) && (md5(md5($user['pass']).$salt) == $password)){ //the same user
setcookie( 'bbuserid', $userid, time()+2592000, '/', '.domain.com' );
//setcookie('password', md5(md5($user['pass']).$salt), 0, '/');
$dbpassword = md5(md5($password) . $user['salt']);
$cookiepass = md5($dbpassword . 'vblicense' );
setcookie( 'bbpassword', $cookiepass, time()+2592000, '/', '.domain.com' );
$HTTP_SESSION_VARS['_script_vbulletin3_cookies_set']++;
}
If I change the vb3 config file to not be 'bb' for cookie prefix (so its ' '), this code sets the cookie for 'bbuserid' and 'bbpassword' - but it won't allow the user to access vb3 with logging in again. I have been racking my brain on this one for 2 days and can't figure it out... Any help would be greatly appreciated. I am not sure if I gave enough information or not..
thank you,
James
Code:
$this_config = $plugin_config['protect']['vbulletin3'];
$vb_db = $this_config['db'];
$user_login = $db->escape($user['login']);
$q = $db->query("SELECT username, password, userid, salt
FROM ${vb_db}user
WHERE username = '$user_login' ");
list($username, $password, $userid, $salt) = mysql_fetch_row($q);
if (($userid>0) && (md5(md5($user['pass']).$salt) == $password)){ //the same user
setcookie( 'bbuserid', $userid, time()+2592000, '/', '.domain.com' );
//setcookie('password', md5(md5($user['pass']).$salt), 0, '/');
$dbpassword = md5(md5($password) . $user['salt']);
$cookiepass = md5($dbpassword . 'vblicense' );
setcookie( 'bbpassword', $cookiepass, time()+2592000, '/', '.domain.com' );
$HTTP_SESSION_VARS['_script_vbulletin3_cookies_set']++;
}
If I change the vb3 config file to not be 'bb' for cookie prefix (so its ' '), this code sets the cookie for 'bbuserid' and 'bbpassword' - but it won't allow the user to access vb3 with logging in again. I have been racking my brain on this one for 2 days and can't figure it out... Any help would be greatly appreciated. I am not sure if I gave enough information or not..
thank you,
James