DevWEB/login.php

20 lines
415 B
PHP

<?php
session_start();
require 'db.php';
if ($_POST) {
$stmt = $pdo->query("SELECT * FROM admin LIMIT 1");
$admin = $stmt->fetch();
if ($admin && password_verify($_POST['password'], $admin['password_hash'])) {
$_SESSION['admin'] = true;
header("Location: index.php");
exit;
}
}
?>
<form method="POST">
<input type="password" name="password">
<button>Login</button>
</form>