用HTML+CSS+JS设计三个页面

2024-12-30 00:04:04
推荐回答(2个)
回答1:

用PHP做过一个,你照着这个换成JS的就可以了:
下面为login.php:
session_start();
unset($_SESSION['name']);
mysql_connect("localhost", "root" ,"Changsha01") or die("Could not connect");
mysql_select_db("test") or die("Could not use db");
if (isset($_POST['submit'])) {
$name = trim($_POST['name']);
$password = trim($_POST['password']);
if (empty($name) || empty($password)) {
$flag = true;
}else {
$query = "SELECT password FROM users WHERE login_name = '" . $name . "'";
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
if ($password == $row['password']) {
$_SESSION['name'] = $name;
header("location: index.php");
} else {
$flag = true;
}
}
}
?>

my document











if (isset($flag)) {
?>



}

?>






Name:
Password:
Wrong Login or Password
 
 





下面为Success.html:

Sucess

Sucess


下面为Failed.html:

Sucess!

Failed!

回答2:

不难 但要花点时间