hjkhjkjhkhjkgjghjhgjhgjghjhghjghjhgjjnbvnvbnvk
bnmbnmbnhjkhjkhjkhjktyutyutyuytutyutyutyhgjgjghjgjghjguytutyry
/
home
/
wjcvelqp
/
biblog
/
Upload FileeE
HOME
<?php require_once 'config/database.php'; if (isset($_SESSION['admin_id'])) { header("Location: admin/"); exit; } $error = ''; if ($_POST) { $username = trim($_POST['username']); $password = trim($_POST['password']); $stmt = $pdo->prepare("SELECT * FROM users WHERE username = ? AND password = ?"); $stmt->execute([$username, $password]); $user = $stmt->fetch(); if ($user) { $_SESSION['admin_id'] = $user['id']; $_SESSION['admin_user'] = $user['username']; header("Location: admin/"); exit; } else { $error = "Invalid username or password!"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Admin Login</title> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="bg-gray-100 min-h-screen flex items-center justify-center"> <div class="max-w-md w-full bg-white rounded-3xl shadow-2xl p-10"> <div class="text-center mb-10"> <img src="assets/images/logo.png" alt="Logo" class="h-20 mx-auto"> <h2 class="text-3xl font-bold text-green-800 mt-6">Admin Login</h2> </div> <?php if($error): ?> <div class="bg-red-100 text-red-700 p-4 rounded-2xl mb-6 text-center"> <?= $error ?> </div> <?php endif; ?> <form method="POST"> <div class="mb-6"> <label class="block mb-2 font-medium">Username</label> <input type="text" name="username" value="Moses" required class="w-full px-5 py-4 border rounded-2xl focus:border-green-700"> </div> <div class="mb-8"> <label class="block mb-2 font-medium">Password</label> <input type="password" name="password" value="123456" required class="w-full px-5 py-4 border rounded-2xl focus:border-green-700"> </div> <button type="submit" class="w-full bg-green-800 hover:bg-green-900 text-white py-5 rounded-2xl text-lg font-semibold"> Login </button> </form> </div> </body> </html>