File size: 627 Bytes
b49f198
 
 
a8d5824
 
 
b49f198
a8d5824
 
 
 
b49f198
a8d5824
 
 
 
 
 
 
 
b49f198
a8d5824
 
b49f198
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
session_start();

// Default credentials
$default_user = 'Admin';
$default_pass = 'Admin123';

// Replace with DB check in production
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $username = trim($_POST["username"]);
    $password = trim($_POST["password"]);

    if ($username === $default_user && $password === $default_pass) {
        $_SESSION["admin"] = true;
        header("Location: dashboard.php");
        exit();
    } else {
        echo "<script>alert('Invalid credentials'); window.location.href='admin.html';</script>";
        exit();
    }
} else {
    header("Location: admin.html");
    exit();
}
?>