<?php
$login = filter_var(trim($_POST['login']),FILTER_SANITIZE_STRING);
$pass = filter_var(trim($_POST['pass']),FILTER_SANITIZE_STRING);
$pass = md5($pass."dfgsffghshf123234");
$mysql = new mysqli('localhost','****','****','****');
$result=$mysql->query("SELECT * FROM `users` WHERE `login`='$login' AND `pass`='$pass'") ;
$user=$result->fetch_assoc();
if (count($user) == 0)
{
echo "Такой пользователь не найден";
exit;
}
else
setcookie('user', $user['name'], time()+3600,"/mir");
$mysql->close();
header('location: /mir' );
?>