Tag: 会话变量

会话变量不工作的PHP

以下是我登录页面的代码,其中登录脚本检查用户的真实性,然后使用头函数重定向到收件箱页面。 <?php session_start(); include_once('config.php'); $user=htmlentities(stripslashes($_POST['username'])); $password=htmlentities(stripslashes($_POST['password'])); // Some query processing on database if(($id_user_fetched<=$id_max_fetched) && ($id_user_fetched!=0)){ $_SESSION['loggedIn'] = 'yes'; header("Location:http://xyz/inbox.php?u=$id_user_fetched"); //echo 'Login Successful'; }else{ echo 'Invalid Login'; echo'<br /> <a href="index.html">Click here to try again</a>'; } }else{ echo mysqli_error("Login Credentials Incorrect!"); } ?> inbox.php页面如下所示: <?php session_start(); echo 'SESSION ='.$_SESSION['loggedIn']; if($_SESSION['loggedIn'] != 'yes'){ echo $message = 'you […]