<?php
// Reset Login Attempts - Run this to clear the lockout
session_start();

echo "<h2>Resetting Login Attempts</h2>";

// Clear login attempts
$_SESSION['login_attempts'] = 0;
$_SESSION['last_attempt_time'] = time();

// Generate fresh CSRF token
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));

echo "✅ Login attempts have been reset<br>";
echo "✅ CSRF token has been regenerated<br>";
echo "✅ You can now try logging in again<br><br>";

echo "<strong>Session Status:</strong><br>";
echo "Login attempts: " . $_SESSION['login_attempts'] . "<br>";
echo "CSRF token: " . substr($_SESSION['csrf_token'], 0, 20) . "...<br><br>";

echo "<a href='login.php' style='padding: 10px 20px; background: #E8663D; color: white; text-decoration: none; border-radius: 5px;'>Go to Login Page</a>";

echo "<br><br><p><strong>Before logging in, make sure you:</strong></p>";
echo "<ol>";
echo "<li>Ran <code>insert-admins.php</code> to create admin users</li>";
echo "<li>Use correct credentials: <code>admin@awesomemall.com</code> / <code>Test@123</code></li>";
echo "<li>Hard refresh the login page (Ctrl+Shift+R) to clear cache</li>";
echo "</ol>";
?>
