我使用此脚本检查 mybb 密码,但出现此错误:“NO”。我使用了 mybb 密码加密方法,但我不知道为什么这不起作用?
<?php
error_reporting(-1);
$MySQL_Host = "localhost";
$MySQL_User = "root";
$MySQL_Pass = "";
$MySQL_DB = "mybb";
$username = 'me';
$password = 'you';
mysql_connect("$MySQL_Host", "$MySQL_User", "$MySQL_Pass") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("$MySQL_DB") or die(mysql_error());
$result = mysql_query("SELECT uid, password, email FROM mybb_users WHERE username='".$username."' AND password='".md5(md5($salt).md5($password))."';");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if( md5(md5($salt).md5($password)) == $result[ 0 ][ 'password' ] )
{
echo "yes" ;
//i need this option
return array( 'id' => $result[ 0 ][ 'uid' ],
'mail' => $result[ 0 ][ 'email' ],
'user' => $username
);
}
else
echo "no";
?>