PNG IHDR x sBIT|d pHYs + tEXtSoftware www.inkscape.org< ,tEXtComment
<?php
session_start();
// Database Configuration
$host = 'localhost';
$dbname = 'u264723324_NuDb';
$user = 'u264723324_NuUu';
$pass = '@WdsdsdAq1231';
$errorMsg = '';
$successMsg = '';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$master_pin = $_POST['master_pin'];
$new_password = $_POST['new_password'];
// 1. Basic Validation
if (strlen($new_password) < 8) {
$errorMsg = "PROTOCOL FAILED: New password must be at least 8 characters.";
} elseif (!preg_match('/^\d{4}$/', $master_pin)) {
$errorMsg = "PROTOCOL FAILED: Master PIN must be exactly 4 digits.";
} else {
// 2. Fetch Admin Record to verify Master PIN
$stmt = $pdo->prepare("SELECT id, master_pin_hash FROM admins WHERE username = :username LIMIT 1");
$stmt->execute([':username' => $username]);
$adminData = $stmt->fetch(PDO::FETCH_ASSOC);
// 3. Verify the Master PIN
if ($adminData && password_verify($master_pin, $adminData['master_pin_hash'])) {
// 4. Hash the new password
$newPasswordHash = password_hash($new_password, PASSWORD_DEFAULT);
// 5. Update Password AND Clear all Brute-Force Lockouts
$updateStmt = $pdo->prepare("
UPDATE admins
SET password_hash = :hash,
failed_attempts = 0,
lockout_time = 0
WHERE id = :id
");
$updateStmt->execute([
':hash' => $newPasswordHash,
':id' => $adminData['id']
]);
$successMsg = "RECOVERY SUCCESSFUL. Security lockouts cleared. You may now log in.";
} else {
// Do not specify if the username or the PIN was wrong. Just fail it.
$errorMsg = "RECOVERY DENIED. Invalid Admin ID or Master PIN.";
}
}
} catch (PDOException $e) {
$errorMsg = "System Database Offline.";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RECOVERY PROTOCOL - City Prime Admin</title>
<style>
:root {
--bg-deep: #050505;
--surface-dark: #0f0f0f;
--border-red: #7f1d1d;
--danger-glow: rgba(220, 38, 38, 0.15);
--text-main: #f8fafc;
--text-muted: #64748b;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Courier New", Courier, monospace; }
body { background-color: var(--bg-deep); color: var(--text-main); display: flex; align-items: center; justify-content: center; min-height: 100vh; overflow: hidden; user-select: none; }
.grid-bg { position: absolute; width: 100vw; height: 100vh; background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px); background-size: 30px 30px; z-index: 0;}
.auth-container { position: relative; z-index: 1; width: 100%; max-width: 450px; padding: 24px; }
.logo-area { text-align: center; margin-bottom: 40px; }
.logo-area h1 { font-size: 1.8rem; color: #ef4444; letter-spacing: 4px; text-transform: uppercase; text-shadow: 0 0 10px rgba(239,68,68,0.5);}
.logo-area p { color: var(--text-muted); font-size: 0.8rem; margin-top: 8px; letter-spacing: 2px;}
.auth-box { background: var(--surface-dark); border: 1px solid var(--border-red); padding: 40px 32px; box-shadow: 0 0 40px var(--danger-glow); position: relative;}
.auth-box::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: #ef4444;}
.error-alert { background: rgba(239, 68, 68, 0.1); border-left: 4px solid #ef4444; color: #ef4444; padding: 16px; font-size: 0.85rem; margin-bottom: 24px; line-height: 1.5; font-weight: bold;}
.success-alert { background: rgba(34, 197, 94, 0.1); border-left: 4px solid #22c55e; color: #22c55e; padding: 16px; font-size: 0.85rem; margin-bottom: 24px; line-height: 1.5; font-weight: bold;}
.form-group { margin-bottom: 24px; }
.form-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px;}
.form-input { width: 100%; background: var(--bg-deep); border: 1px solid rgba(255,255,255,0.1); color: var(--text-main); padding: 14px 16px; font-size: 1rem; outline: none; transition: 0.2s; font-family: monospace; letter-spacing: 1px;}
.form-input:focus { border-color: #ef4444; box-shadow: inset 0 0 10px rgba(239,68,68,0.2);}
.forgot-pass { text-align: left; margin-bottom: 32px; }
.forgot-pass a { color: var(--text-muted); font-size: 0.8rem; text-decoration: none; transition: 0.2s; border-bottom: 1px solid transparent;}
.forgot-pass a:hover { color: #ef4444; border-color: #ef4444; }
.primary-btn { width: 100%; background: transparent; color: #ef4444; border: 1px solid #ef4444; padding: 16px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: 0.2s; text-transform: uppercase; letter-spacing: 2px;}
.primary-btn:hover { background: #ef4444; color: white; box-shadow: 0 0 15px rgba(239,68,68,0.4);}
</style>
</head>
<body oncontextmenu="return false;">
<div class="grid-bg"></div>
<div class="auth-container">
<div class="logo-area">
<h1>Override Protocol</h1>
<p>MASTER PIN REQUIRED</p>
</div>
<div class="auth-box">
<?php if (!empty($errorMsg)): ?>
<div class="error-alert">
> <?php echo htmlspecialchars($errorMsg); ?>
</div>
<?php endif; ?>
<?php if (!empty($successMsg)): ?>
<div class="success-alert">
> <?php echo htmlspecialchars($successMsg); ?>
<br><br>
<a href="admin-login.php" style="color: #22c55e; text-decoration: underline;">Return to Login</a>
</div>
<?php else: ?>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="POST" autocomplete="off">
<div class="form-group">
<label class="form-label">Admin ID</label>
<input type="text" name="username" class="form-input" required autocomplete="off" onpaste="return false;" oncopy="return false;">
</div>
<div class="form-group">
<label class="form-label">Secret Master PIN</label>
<input type="password" name="master_pin" class="form-input" required autocomplete="new-password" onpaste="return false;" oncopy="return false;" pattern="\d{4}" maxlength="4" placeholder="****">
</div>
<div class="form-group">
<label class="form-label">New Authentication Key</label>
<input type="password" name="new_password" class="form-input" required autocomplete="new-password" onpaste="return false;" oncopy="return false;" placeholder="Min 8 characters">
</div>
<div class="forgot-pass">
<a href="admin-login.php">< ABORT AND RETURN TO LOGIN</a>
</div>
<button type="submit" class="primary-btn">
OVERRIDE CREDENTIALS
</button>
</form>
<?php endif; ?>
</div>
</div>
</body>
</html>
b IDATxytVսϓ22 A@IR:hCiZ[v*E:WũZA ^dQeQ @ !jZ'>gsV仿$|?g)&x-E