<?php
function is_user(){
global $mysql;
static $user = 0;
//Авторизация пользователя
if(empty($user)){
if(isset($_COOKIE['userid']) && isset($_COOKIE['password']))
{ // start auth
$usdata = $mysql -> query("SELECT * FROM `".PREFIX."users` WHERE `id` = '".num($_COOKIE['userid'])."' LIMIT 1") -> fetch_assoc();
if (!empty($usdata)) { $user = $usdata;}
} // end auth
}
return $user;
}
?>