我创建了一个登录页面 login.php,当用户登录时,他们被重定向到 login-home.php,然后,
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
echo "Welcome to the member's area, " . $_SESSION['username'] . "!";
} else {
echo "Please log in first to see this page.";
}
我得到请先登录。
为什么这实际上不会登录?
登录.php
<?PHP
error_reporting(9);
require_once("./include/membersite_config.php");
if(isset($_POST['submitted']))
{
$users['admin'] = array('password' => 'admin', 'redirect' => 'admin.php');
$users[$username] = array('password' => $password, 'redirect' => 'login-home.php');
if(array_key_exists($_POST['username'],$users)) {
if($_POST['password'] == $users[$_POST['username']]['password']) {
$_SESSION['loggedIn'] = true;
header('Location:'.$users[$_POST['username']]['redirect']);
exit();
}
}
if($fgmembersite->Login())
{
$fgmembersite->RedirectToURL("login-home.php");
}
}
?>