Your IP : 216.73.217.78


Current Path : /home/seto/testhive.pm/admin/
Upload File :
Current File : /home/seto/testhive.pm/admin/login.php

<?php
require_once __DIR__ . '/../includes/config.php';
require_once __DIR__ . '/../includes/db.php';

if (session_status() === PHP_SESSION_NONE) session_start();

if (!empty($_SESSION[ADMIN_SESSION])) {
    header('Location: /admin/index.php'); exit;
}

$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $pass = $_POST['password'] ?? '';
    $hash = db_config('admin_password_hash');
    if ($hash && password_verify($pass, $hash)) {
        $_SESSION[ADMIN_SESSION] = true;
        header('Location: /admin/index.php'); exit;
    }
    $error = 'Неверный пароль';
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>LinkFlow — Вход</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
</head>
<body class="bg-light">
<div class="container" style="max-width:380px;padding-top:100px">
  <div class="card shadow-sm">
    <div class="card-body p-4">
      <h4 class="mb-4 text-center">LinkFlow</h4>
      <?php if ($error): ?>
        <div class="alert alert-danger py-2"><?= htmlspecialchars($error) ?></div>
      <?php endif ?>
      <form method="post">
        <div class="mb-3">
          <label class="form-label">Пароль</label>
          <input type="password" name="password" class="form-control" autofocus required>
        </div>
        <button class="btn btn-primary w-100">Войти</button>
      </form>
    </div>
  </div>
</div>
</body>
</html>