<?php require_once('./includes/connection.php'); ?>
<?php require_once('./includes/sql_func.php');?>
<?php
if(isset($_POST['submit']))
{
$isValid = verify_account($_POST['username'],$_POST['password']);
if($isValid){
session_name($_POST['username']);
session_start();
$_SESSION['isLoggedIn'] = true;
session_write_close();
redirect_to("user_panel.php");
}else{
echo "Invalid Username and password";
}
}
?>
<?php require_once('./includes/header.php');?>
假设用户输入了有效的用户名和密码,它将创建一个会话变量并将不同的值存储在会话数组中。但是当我将用户重定向到另一个页面时
<?php require_once('./includes/connection.php'); ?>
<?php require_once('./includes/sql_func.php');?>
<?php
session_start();
?>
<?php require_once('./includes/header.php');?>
<?php
if(isset($_SESSION['isLoggedIn'])){
echo "Hello User";
}
?>
<?php require_once('./includes/footer.php');?>
上面代码中的这一行
isset($_SESSION['isLoggedIn'])
是不是被认为是真的?