我认为我的 crypt() 有问题;php函数。我的错误日志中没有显示任何错误。
我在验证登录页面时遇到了困难。
if( $page_mode == 'Login' )
{
require "globe.php";
//simple post from below
$username = htmlentities(trim($_POST['username']));
$username = mysqli_real_escape_string($mysqli, $username);
$password = trim($_POST['password']);
$query = mysqli_query($mysqli, "SELECT * FROM Persons WHERE Username = '$username'");
$row = mysqli_fetch_assoc($query);
$numrows = mysqli_num_rows($query);
$dbuser = $row['Username'];
$dbpass = $row['Password'];
$hashed_password = crypt($password, $dbpass);
if( ($username == '') || ($password == '') ) {
$error_string .= '<font color=red>You have left either the username or password field blank!</font>';
}
else if ($numrows == 0)
{
$error_string .= '<font color=red>No username can be found!</font>';
}
else if ($numrows == 1)
{
if ($password == $hashed_password)
{
$error_string .= '<font color=red>Details checked out</font>';
}
}
else {
$error_string .= '<font color=red>There was an error. Please contact an Admin</font>';
}
}
当我输入用户名和密码进行测试时,不会显示任何错误提示。
如果有人能解决这个问题将不胜感激
应该提到该错误仅在使用 usepass 检查 dbpass 时才开始出现