我正在创建一个受密码保护的网页。一切正常,但我的问题是,每当用户从我的网页复制网址并粘贴另一个浏览器时,该页面就会显示相同的数据(我有许多网页,所有页面都显示相关数据)。那不是我想要的。我希望它再次自动进入登录页面。我需要相同的会话过期脚本我的代码如下所示。
<?php
$host = ""; // Your host address to your database on your server. Usually "localhost". Check with your hosting provider
$user = ""; // Your username you set up for this database on your server
$pass = ""; // Your password you set up for this database on your server
$db = ""; // The database name that you will be connecting to
// Connecting to the MySQL database
mysql_connect($host, $user, $pass);
mysql_select_db($db);
if (isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
// Query to check to see if the username and password supplied match the database records
$sql = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1";
$res = mysql_query($sql);
// If login information is correct
if (mysql_num_rows($res) == 1)
{
header('Location: done.php');
}
// If login information is invalid
else {
header('Location: error.php');
}
}
?>
谢谢 !