<!DOCTYPE html>
<html lang="en">
<?php
$con = new mysqli('127.0.0.1', 'root', '', 'user');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = $_POST['email'];
$password = $_POST['password'];
$stmt = $con->prepare("SELECT passwordHash FROM users WHERE email = ?");
$stmt->bind_param("s", $email);
$stmt->execute();
$res = $stmt->get_result()->fetch_assoc();
if ($res && password_verify($password, $res['passwordHash'])) {
echo "Hasło prawidłowe";
} else {
echo "Hasło nieprawidłowe";
}
}
?>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="login.php" method="post">
<label>email:</label>
<input type="email" name="email"><br><br>
<label>password:</label>
<input type="password" name="password"><br><br>
<button type="submit">send</button>
</form>
</body>
</html>13 views