Файл: sys/session_user.php
Строк: 20
<?php
if(is_user()){
$login = check($_COOKIE['login']);
$id_session = session_id();
$time = time() + 1200;
# если логин зашел впервые #
$setz = DB::run() -> queryFetch("SELECT * FROM `session_user` WHERE `user`=? LIMIT 1",array($login));
if($setz['user'] == NULL){
DB::run() -> query("INSERT INTO `session_user`(`user`, `time`, `session_id`) VALUES (?,?,?)",array($login,$time,$id_session));
} else {
DB::run() -> query("UPDATE `session_user` SET time=? WHERE `user`=?",array($time,$login));
}
}
$del_ses = DB::run()->query("SELECT * FROM `session_user`");
$del_ses = $del_ses -> fetchAll();
foreach($del_ses AS $sess){
if($sess['time'] <= time()){
DB::run() -> query("DELETE FROM `session_user` WHERE `id`=?",array($sess['id']));
}
}
stlol();
?>