🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:login.php
<?php include '../config.php'; $error = ""; if(isset($_POST['login'])) { $username = $conn->real_escape_string($_POST['username']); $password = $_POST['password']; $res = $conn->query("SELECT * FROM admins WHERE username = '$username'"); if($res && $res->num_rows > 0) { $admin = $res->fetch_assoc(); if(password_verify($password, $admin['password'])) { $_SESSION['admin_logged_in'] = true; $_SESSION['admin_id'] = $admin['id']; $_SESSION['admin_user'] = $admin['username']; header("Location: index.php"); exit(); } else { $error = "Invalid password!"; } } else { $error = "Admin user not found!"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Admin Login | iprinters.lk</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> body { background: #f1f5f9; height: 100vh; display: flex; align-items: center; justify-content: center; } .login-card { width: 100%; max-width: 400px; border: none; border-radius: 20px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); } .btn-primary { border-radius: 10px; padding: 12px; font-weight: 600; } .form-control { border-radius: 10px; padding: 12px; border: 1px solid #e2e8f0; } </style> </head> <body> <div class="container"> <div class="card login-card mx-auto"> <div class="card-body p-5"> <div class="text-center mb-4"> <h3 class="fw-bold">Admin Login</h3> <p class="text-muted">Enter your credentials to continue</p> </div> <?php if($error): ?> <div class="alert alert-danger py-2" style="border-radius: 10px; font-size: 0.9rem;"> <i class="fa fa-exclamation-circle me-1"></i> <?php echo $error; ?> </div> <?php endif; ?> <form action="login.php" method="POST"> <div class="mb-3"> <label class="form-label small fw-bold">Username</label> <div class="input-group"> <span class="input-group-text bg-light border-end-0"><i class="fa fa-user text-muted"></i></span> <input type="text" name="username" class="form-control border-start-0" placeholder="admin" required> </div> </div> <div class="mb-4"> <label class="form-label small fw-bold">Password</label> <div class="input-group"> <span class="input-group-text bg-light border-end-0"><i class="fa fa-lock text-muted"></i></span> <input type="password" name="password" class="form-control border-start-0" placeholder="••••••••" required> </div> </div> <button type="submit" name="login" class="btn btn-primary w-100 mb-3">Login to Dashboard</button> <div class="text-center"> <a href="../index.php" class="text-decoration-none small text-muted"><i class="fa fa-arrow-left me-1"></i> Back to Site</a> </div> </form> </div> </div> </div> </body> </html>
Save Changes
Cancel
Create New File
Create New Folder