Function for check password SHA256
//
@return true if password and nickname match
function check_password_db($nickname,$password) {
// Here u have to include your DB connection and select!
$a=mysql_query("SELECT password FROM authme where username = '$nickname'");
if(mysql_num_rows($a) == 1 ) {
$password_info=mysql_fetch_array($a);
$sha_info = explode("$",$password_info[0]);
} else return false;
if( $sha_info[1] === "SHA" ) {
$salt = $sha_info[2];
$sha256_password = hash('sha256', $password);
$sha256_password .= $sha_info[2];;
if( strcasecmp(trim($sha_info[3]),hash('sha256', $sha256_password) ) == 0 ) return true;
else return false;
}
}上面的怎么写成PHP的检测。求高人指点