l110/H11/11.00.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Form</title>
</head>
<body>
<h2>Login Form</h2>
<form action="login.php" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br>
<input type="submit" value="Login">
</form>
<?php
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get username and password from the form
$username = $_POST["username"];
$password = $_POST["password"];
// Check if the username and password are correct (you would usually validate against a database)
// For demonstration purposes, let's use a simple check
$correctUsername = "user123";
$correctPassword = "pass123";
if ($username == $correctUsername && $password == $correctPassword) {
// Successful login
echo "Login successful!";
} else {
// Invalid credentials
echo "Invalid username or password.";
}
}
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse