| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- if (session_status() === PHP_SESSION_NONE) session_start();
- if (!empty($_SESSION['pl_authed'])) {
- header('Location: /index.php');
- exit;
- }
- $error = '';
- if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- $pw = $_POST['password'] ?? '';
- $codes = file_exists(__DIR__ . '/_private/config.php')
- ? (require __DIR__ . '/_private/config.php')
- : [];
- $ok = false;
- foreach ($codes as $code) {
- if (password_verify($pw, $code['hash'])) { $ok = true; break; }
- }
- if ($ok) {
- session_regenerate_id(true);
- $_SESSION['pl_authed'] = true;
- $next = $_GET['next'] ?? '/index.php';
- // Prevent open redirect — only allow relative paths on this host
- if (!preg_match('/^\/[a-zA-Z0-9\/_\-\.]*$/', $next)) $next = '/index.php';
- header('Location: ' . $next);
- exit;
- }
- usleep(600000); // throttle brute-force
- $error = 'Incorrect password. Please try again.';
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Sign In — ICG Magnetics</title>
- <style>
- *{box-sizing:border-box;margin:0;padding:0}
- html,body{height:100%;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#0f172a;display:flex;align-items:center;justify-content:center}
- .card{background:#1e293b;border-radius:12px;padding:40px 44px;width:100%;max-width:380px;box-shadow:0 20px 60px rgba(0,0,0,.5)}
- .logo{font-size:13px;font-weight:600;color:#64748b;letter-spacing:.8px;text-transform:uppercase;margin-bottom:6px}
- h1{font-size:22px;font-weight:700;color:#f8fafc;margin-bottom:28px}
- label{display:block;font-size:12px;font-weight:600;color:#94a3b8;margin-bottom:6px;letter-spacing:.3px}
- input[type=password]{
- display:block;width:100%;padding:11px 14px;
- background:#0f172a;border:1px solid #334155;border-radius:7px;
- color:#f1f5f9;font-size:15px;outline:none;
- transition:border-color .15s
- }
- input[type=password]:focus{border-color:#3b82f6}
- .err{margin-top:14px;padding:10px 14px;background:#450a0a;border:1px solid #7f1d1d;border-radius:6px;color:#fca5a5;font-size:13px}
- button{
- margin-top:22px;width:100%;padding:12px;
- background:#3b82f6;border:none;border-radius:7px;
- color:white;font-size:15px;font-weight:600;cursor:pointer;
- transition:background .15s
- }
- button:hover{background:#2563eb}
- </style>
- </head>
- <body>
- <div class="card">
- <div class="logo">ICG Magnetics</div>
- <h1>Profit & Loss</h1>
- <form method="post" autocomplete="off">
- <label for="pw">Access Code</label>
- <input type="password" id="pw" name="password" autofocus placeholder="Enter access code">
- <?php if ($error): ?>
- <div class="err"><?= htmlspecialchars($error) ?></div>
- <?php endif; ?>
- <button type="submit">Sign In</button>
- </form>
- </div>
- </body>
- </html>
|