我正在为我的网站创建一个登录系统,当用户登录时我正在使用标题调用将它们重定向到另一个页面,标题调用没有执行,我没有收到任何错误,尽管我确实有打开one.com错误报告。
登录验证
if (isset($_POST['login'])&& $_POST['login'] !== "") {
$log = $login->check_login($username);
if ($log) {
// Registration Success
header("Location: http://joshpercival.co.uk/webapp/indx.php");
} else {
// Registration Failed
$password_error='Wrong username or password';
}
}
登录类
public function check_login($username) {
$sql2="SELECT user_id FROM users WHERE username='$username'";
//checking if the username is available in the table
$check = Database::getInstance()->getConnection()->query($sql2);
$count_row = $check->num_rows;
if ($count_row == 1) {
// this login var will use for the session thing
$_SESSION['user_id'] = $user_data['user_id'];
return true;
}
else{
return false;
}
}