d1nka (24 ноя 2018 10:12)
|
|
tproger, подключение к бд $mysqli = mysqli_connect('localhost', 'ffgdggd', 'T1n9N7q6', 'ffgdggd'); mysqli_set_charset($mysqli, 'utf8'); if (!$mysqli) exit('<center>Ошибка подключения к MySQL(i)</center>'); иницилизация юзера if (isset($_COOKIE['login']) && isset($_COOKIE['pass'])) { $login = mysqli_real_escape_string($mysqli, html($_COOKIE['login'])); $pass = mysqli_real_escape_string($mysqli, html($_COOKIE['pass'])); $sql = mysqli_query($mysqli, "select * from `users` where `login` = '$login' and `pass` = '$pass' limit 1"); $ch = mysqli_num_rows($sql); if ($ch > 0) { $user = mysqli_fetch_assoc($sql); $_SESSION['user_id'] = $user['id']; } } |