BinaryX
03-22-2010, 07:29 PM
OHai,
Im trying to create a login system on my site that uses the userinfo from the vb_user table, im using version 3.8.4 of vbulletin. It always returns me invalid password and when it outputs both md5's they do not match.
how is the encryption handled in VB?
public function doLogin() {
$connection = $this->dbConnect("r");
$this->SelectDB("r");
$account = $this->SanitizeName($_POST['account']);
$password = $this->SanitizeName($_POST['password']);
if(strLen($account) < 1 || strlen($password) < 1) {
return false;
}
$result = mysql_query('SELECT Username,password,salt FROM vb_user WHERE Username="'.$account.'" ') or die("Could not execute the query (E6).");
$vb_info[0] = mysql_result($result, 0, "Username"); //username
$vb_info[1] = mysql_result($result, 0, "password"); //password
$vb_info[2] = mysql_result($result, 0, "salt"); //salt (md5)
$md5_password = md5(md5(md5($password) . $vb_info[2]));
echo $vb_info[0]. "<br/>";
echo $vb_info[1]. "<br/>";
echo $vb_info[2]. "<br/>";
echo $md5_password. "<br/>";
if($vb_info[0] != $account) {
return false;
} else if($vb_info[1] != $md5_password) {
return false;
}
$_SESSION['account'] = $account;
return true;
}
Thanks!
Im trying to create a login system on my site that uses the userinfo from the vb_user table, im using version 3.8.4 of vbulletin. It always returns me invalid password and when it outputs both md5's they do not match.
how is the encryption handled in VB?
public function doLogin() {
$connection = $this->dbConnect("r");
$this->SelectDB("r");
$account = $this->SanitizeName($_POST['account']);
$password = $this->SanitizeName($_POST['password']);
if(strLen($account) < 1 || strlen($password) < 1) {
return false;
}
$result = mysql_query('SELECT Username,password,salt FROM vb_user WHERE Username="'.$account.'" ') or die("Could not execute the query (E6).");
$vb_info[0] = mysql_result($result, 0, "Username"); //username
$vb_info[1] = mysql_result($result, 0, "password"); //password
$vb_info[2] = mysql_result($result, 0, "salt"); //salt (md5)
$md5_password = md5(md5(md5($password) . $vb_info[2]));
echo $vb_info[0]. "<br/>";
echo $vb_info[1]. "<br/>";
echo $vb_info[2]. "<br/>";
echo $md5_password. "<br/>";
if($vb_info[0] != $account) {
return false;
} else if($vb_info[1] != $md5_password) {
return false;
}
$_SESSION['account'] = $account;
return true;
}
Thanks!