要實現(xiàn)一個簡單的登錄頁面,可以按照以下步驟進(jìn)行:
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<h2>Login</h2>
<form action="login.php" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username"><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="Login">
</form>
</body>
</html>
<?php
// 驗證用戶輸入的用戶名和密碼,這里簡單示例直接寫死
$username = "admin";
$password = "123456";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$input_username = $_POST['username'];
$input_password = $_POST['password'];
if ($input_username == $username && $input_password == $password) {
echo "Login successful!";
} else {
echo "Login failed. Please check your username and password.";
}
}
?>
以上是一個簡單的示例,實際中需要結(jié)合數(shù)據(jù)庫存儲用戶信息,并使用加密技術(shù)保護(hù)用戶密碼。