【发布时间】:2017-04-30 06:58:12
【问题描述】:
实际上,我不明白我们为什么要使用 "$_SESSION['authuser'] = 1;"在php代码中,我的代码如下
<?php
session_start();
$_SESSION['username'] = $_POST['user'];
$_SESSION['userpass'] = $_POST['pass'];
$_SESSION['authuser'] = 1;
//Check username and password information
if(($_SESSION['username'] == 'joe') and
($_SESSION['userpass'] == '123')) {
$_SESSION['authuser'] = 1;
}
else
{
echo 'Sorry, but you don\'t have permission to view this page!';
exit();
}
?>
【问题讨论】: