我在数据库中有一个名为“已激活”的值,该值存储在会话中。
您可以在下面看到我的代码。
已登录的用户处于激活状态的值为“ 1”,但仍被重定向到“ accountdea.php”,我不知道为什么。
您的帮助将不胜感激!
谢谢!
<?php
// Initialize the session
session_start();
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: login.php");
exit;
}
?>
<?php if($_SESSION["activated"] == 0){
header("location: accountdea.php");
};
?>
答案 0 :(得分:0)
<?php
// Initialize the session
session_start();
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: login.php");
exit;
}
?>
<?php
$activated = $_SESSION["activated"];
echo $activated;
if($_SESSION["activated"] == 0){
header("location: accountdea.php");
};
?>
检查$ activated的值是0还是1(如果没有启动0个会话)。它将进入accountdea.php