这段代码有什么问题?
登录.html:
<?php
session_start();
if (isset($_SESSION['password'])) {
header("location:admin.php");
} else {
echo "<html>
<head>
<title>
FLG iRadio Station
</title>
<link rel='stylesheet' type='text/css' href='css/main.css' />
</head>
<body>
<center>
TO LOGIN, SUBMIT PASSWORD
<form name='login' id='login' method='POST' action=logincheck.php>
<input type='password' NAME='password' id='password' maxlength='15' />
<input type='submit' value='Submit Password'/>
</form>
</center>
</body>
</html>";
}
?>
登录检查.php:
<?php
$password = $_POST['password'];
if($password == "flgpdrii"){
session_register("password");
header("location:admin.php");
}
else
{
echo "Wrong Password! <a href='login.html'>Login again</a>";
}
?>
管理员.php:
<?php
session_start();
if (isset($_SESSION['password'])) {
echo "Welcome Admin";
} else {
echo "Login <a href='login.html'>here</a>";
}
echo $_SESSION['password'];
?>
和注销.php:
<?php
// Inialize session
session_start();
// Delete certain session
unset($_SESSION['username']);
// Delete all session variables
session_destroy();
// Jump to login page
header('Location: login.html');
?>
输入正确的密码,它将重定向到 admin.php 并回显“在此处登录”。它必须是“欢迎管理员”
有人可以帮忙吗?