I am not getting any output from `" $_SESSION['name'] = $user_name;" or $_SESSION['email'] = $_POST['in_email'];`
它在MariaDB上运行。似乎我缺少了一些东西,尝试一些好东西。但是用尽了主意。命中或将不胜感激。
if ($stmt = $link->prepare('SELECT user_id, user_password_hash, user_name FROM users WHERE user_email = ?')) {
$stmt->bind_param('s', $inemail);
$stmt->execute();
$stmt->store_result();
}
if ($stmt->num_rows > 0) {
$stmt->bind_result($user_id, $user_password_hash, $user_name);
$stmt->fetch();
if (password_verify($_POST['in_password'], $user_password_hash)) {
session_regenerate_id();
$_SESSION['loggedin'] = TRUE;
$_SESSION['email'] = $_POST['in_email'];
$_SESSION['id'] = $user_id;
$_SESSION['name'] = $user_name;
header("Location: ../index.php");
exit;
我俯瞰什么?任何命中将不胜感激。
答案 0 :(得分:1)
您需要确保您正在运行session_start();
这将基于通过GET或POST请求传递或通过cookie传递的会话标识符来创建会话或恢复当前会话。