登录代码,如果成功,则实现标头重定向。它在随机时间工作,我不知道我在做什么来让它工作,然后让它失败。
<?php
ob_start();
require ("include/PassHash.php");
if(isset($_POST['login'])){
// Returns more than 0 rows (Email found)
if($total>0 && PassHash::check_password($row['password'], $_POST['password'])){
// Correct credentials.
$_SESSION['user_id'] = $row['id'];
$_SESSION['user_email'] = $email;
session_set_cookie_params(24*60*60);
header("Location: /index.php?p=user_account");
exit();
ob_end_flush();
} else {
// Incorrect password / email.
}
}
?>