You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
523 B

<?php
require '../include/db.php';
session_start();
$login = strtolower($_POST['login']);
$password = hash("sha256", $_POST['password']);
$q = $pdo->prepare(
'SELECT * FROM users WHERE login = :login AND password = :password');
$q->execute([
'login' => $login,
'password' => $password,
]);
$users = $q->fetchAll();
if (count($users) == 1)
{
$_SESSION["login"] = $_POST["login"];
header("Location: /index.php");
}
else {
$_SESSION["login"] = "";
header("Location: /index.php?error=201");
}