$count
如果等于 1 但不等于 1,我的 MySQL 会话将开始,我不知道如何修复它,我对 php 相当陌生,我更喜欢使用 sha1 而不是 BCrypt
<?php
//login form
mysql_connect("xxxxx","xxxxxx","xxxxxx") or die( mysql_error() );
mysql_select_db("u940004575_chat");
$myusername = stripslashes( $myusername );
$mypassword = stripslashes( $mypassword );
$sha1mypassword = sha1( $mypassword );
$myusername = mysql_real_escape_string( $myusername );
$mypassword = mysql_real_escape_string( $mypassword );
$sha1mypassword = mysql_real_escape_string( $sha1mypassword );
$sql = mysql_query("SELECT id FROM users WHERE username='$myusername' and password='$sha1mypassword'")or die( mysql_error() );
$result = mysql_query( $sql );
if ( $sql ) {
$count = mysql_num_rows( $sql );
}
if ( $count == 1 ) {
session_register("myusername");
session_register("mypassword");
header("location:home.php");
} else {
echo "Wrong Username or Password";
}
?>
如果有人可以帮助我,那就太好了,任何修复都将不胜感激。