- 717
- 150
PHP:
<?php
$email = filter_var(trim($_POST['email']), FILTER_SANITIZE_STRING);
$password = filter_var(trim($_POST['password']), FILTER_SANITIZE_STRING);
$passwor = md5($password);
require_once 'connection.php';
$link = mysqli_connect($host, $user, $passwordf, $database)
or die("ќшибка " . mysqli_error($link));
$result = $link->query("SELECT 'email' , 'password' FROM users WHERE 'email' = '$email' AND 'password' = '$passwor'") or die("ќшибка rfgasf" . mysqli_error($link));
$user = $result->fetch_assoc();
if((count($user)) == 0)
{
echo md5("123456");
exit();
} else if((count($user)) > 0) {
echo "salam brat";
exit();
}
setcookie('user', $user['nickname'], time() + 3600, "/");
mysqli_close($link);
?>