Файл: core/class/core.php
Строк: 39
<?
session_name('sid');
session_start(); // старт сессии
if(version_compare(PHP_VERSION, '5.2.1') < 0) {
die('Ошибка! Версия PHP должна быть 5.2.1 или выше!');
}
$ip = secur($_SERVER['REMOTE_ADDR']); // определяем айпи
$ua = secur($_SERVER['HTTP_USER_AGENT']); // определяем софт
$set = core::$dbs->queryFetch("SELECT * FROM setting WHERE id = ? LIMIT 1", array(1));
/* проверка Авторизации */
$user_id = False;
$user_ps = False;
if (isset($_COOKIE['cookie_id']) && isset($_COOKIE['cookie_ps'])) {
$user_id = abs((int)$_COOKIE['cookie_id']);
$user_ps = secur($_COOKIE['cookie_ps']);
}elseif(isset($_SESSION['session_id']) && isset($_SESSION['session_ps'])){
$user_id = abs((int)$_SESSION['session_id']);
$user_ps = secur($_SESSION['session_ps']);
}
if($user_id && $user_ps){
$user = core::$dbs->query("SELECT * FROM `users` WHERE `id`=? LIMIT 1;",array($user_id));
if($user->rowCount() == 1){
$user = $user -> fetch();
core::$dbs->query("UPDATE `users` SET `ip` = ?, `soft` = ?, `onl` = ? WHERE `id` = ?",array($ip,$ua,time(),$user['id']));
$user_id = $user['id'];
$level = $user['level'];
$nick = $user['user'];
} else {
unset($_SESSION['session_id']);
unset($_SESSION['session_ps']);
SetCookie('cookie_id','');
SetCookie('cookie_ps','');
}
} else {
unset($_SESSION['session_id']);
unset($_SESSION['session_ps']);
SetCookie('cookie_id','');
SetCookie('cookie_ps','');
}
function hi($usr){
if(date("H")<=4 || date("H")>=23) $re = 'Доброй ночи, <b>'.$usr.'</b>';
if(date("H")>=5 && date("H")<=10) $re = 'Доброе утро, <b>'.$usr.'</b>';
if(date("H")>=11 && date("H")<=17) $re = 'Добрый день, <b>'.$usr.'</b>';
if(date("H")>=18 && date("H")<=22) $re = 'Добрый вечер, <b>'.$usr.'</b>';
return $re;
}
core::$dbs->query("DELETE FROM `bann` WHERE `time_bann` < ?",array(time()));
// Основные переменные
$id = isset($_REQUEST['id']) ? num($_REQUEST['id']) : '';
$do = isset($_REQUEST['do']) ? secur($_REQUEST['do']) : '';
$act = isset($_REQUEST['act']) ? secur($_REQUEST['act']) : '';
$end = $set['end'];
$onl = $set['onl'];
$index_end = $set['index_end'];
?>