CoolFace
Apppublic

starinfolab/codecraft-conductor-wizard

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
login.php57 linesDownload Raw Back to root
1```php2<?php3require_once 'db_connect.php';4session_start();5 6// Hardcoded admin credentials (for demo only)7define('ADMIN_USERNAME', 'admin');8define('ADMIN_PASSWORD', 'password123');9 10if ($_SERVER['REQUEST_METHOD'] === 'POST') {11    if ($_POST['username'] === ADMIN_USERNAME && $_POST['password'] === ADMIN_PASSWORD) {12        $_SESSION['loggedin'] = true;13        header('Location: admin.php');14        exit;15    } else {16        $error = "Invalid credentials!";17    }18}19?>20<!DOCTYPE html>21<html lang="en">22<head>23    <meta charset="UTF-8">24    <meta name="viewport" content="width=device-width, initial-scale=1.0">25    <title>Login</title>26    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">27</head>28<body class="bg-light">29    <div class="container py-5">30        <div class="row justify-content-center">31            <div class="col-md-6 col-lg-4">32                <div class="card shadow">33                    <div class="card-body p-5">34                        <h2 class="text-center mb-4">Admin Login</h2>35                        <?php if (isset($error)): ?>36                            <div class="alert alert-danger"><?= $error ?></div>37                        <?php endif; ?>38                        <form method="POST">39                            <div class="mb-3">40                                <label for="username" class="form-label">Username</label>41                                <input type="text" class="form-control" id="username" name="username" required>42                            </div>43                            <div class="mb-3">44                                <label for="password" class="form-label">Password</label>45                                <input type="password" class="form-control" id="password" name="password" required>46                            </div>47                            <button type="submit" class="btn btn-primary w-100">Login</button>48                        </form>49                    </div>50                </div>51            </div>52        </div>53    </div>54    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>55</body>56</html>57```