🐘 2. PHP: login.php
<?php
// Example username and password
$correct_username = "admin";
$correct_password = "12345";
// Get form data
$username = $_POST['username'];
$password = $_POST['password'];
// Check credentials
if ($username === $correct_username && $password === $correct_password) {
echo "✅ Login successful! Welcome, $username.";
} else {
echo "❌ Invalid username or password.";
}
?>
✅ How to run this:
-
Save the HTML file as
login.html -
Save the PHP file as
login.php -
Place both files in your local web server directory (e.g.,
htdocsin XAMPP) -
Start your web server (Apache)
-
Open browser and go to:
http://localhost/login.html