Файл: kernel/classes/core.php
Строк: 5
<?php
session_start();
$ip = check($_SERVER['REMOTE_ADDR']);
$soft = check($_SERVER['HTTP_USER_AGENT']);
// проверка авторизации COOKIE + SESSION
if (isset($_COOKIE['auth'])) {
$data = explode('::', base64_decode($_COOKIE['auth']));
} elseif (isset($_SESSION['auth'])) {
$data = explode('::', base64_decode($_SESSION['auth']));
}
$Sql = $dbs->prepare("SELECT * FROM user WHERE id = ? AND pass = ? LIMIT 1");
$Sql->execute([intval($data[0]),check($data[1])]);
if ($Sql -> rowCount() > 0) {
$user = $Sql -> fetch(PDO::FETCH_ASSOC);
$st = $dbs->prepare("UPDATE user SET ip = ?, soft = ?, last = ? WHERE id = ? LIMIT 1");
$st->execute([$ip,$soft,time(),$user['id']]);
} else {
setcookie('auth', NULL);
unset($_SESSION['auth']);
}
?>