Answer the question
In order to leave comments, you need to log in
How to fix authorization on the site?
I am making an online game based on the prehistoric "core" of year 16. When I try to authorize (the script requests access to the database and everything is processed there by gypsy magic, cookies are recorded and there should be a redirect to the game page) the redirect does not want to happen: there are no errors, the data is correct , but either something is wrong with the cookies, or something else. Please help
$login = _string($_POST['login']);
$password = _string($_POST['password']);
if($login && $password) {
$q = mysql_query('SELECT * FROM `users` WHERE `login` = "'.$login.'" AND `password` = "'.$password.'" LIMIT 1');
$user = mysql_fetch_array($q);
if(!$user) {
echo '<div class="block center">Неверные данные!</div>';
}
if($user) {
setCookie('id', $user['id'], time() + 86400 * 365, '/');
setCookie('password', $password, time() + 86400 * 365, '/');
header('location: /game.php');
}
}
Answer the question
In order to leave comments, you need to log in
there is no error, the data is correct,Holy naivete...
or something elseYes, definitely something else, see point 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question