🐘 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:

  1. Save the HTML file as login.html

  2. Save the PHP file as login.php

  3. Place both files in your local web server directory (e.g., htdocs in XAMPP)

  4. Start your web server (Apache)

  5. Open browser and go to: http://localhost/login.html


អត្ថបទបន្ទាប់ អត្ថបទមុន