function get($name) { if (!self::$user) { db::table('users'); db::where('user_id', $_SESSION['WEB_USER_ID']); db::where('user_pub', 1); db::limit(1); self::$user = db::assoc(); } if (!isset(self::$user[$name])) { return false; } return self::$user[$name]; }
function observerMemory() { $cookie = cookie::get(md5(SERVER)); if ($cookie) { $err = false; list($username, $userid, $hash) = explode(',', $cookie); $userid = intval($userid); db::table('users'); db::where('user_id', $userid); $row = db::assoc(); $word = 'legenda'; if (md5($row['user_login'] . $word) != $hash) { $err = true; } if (db::rows() == 0) { $err = true; } if ($err) { unset($_SESSION['WEB_AUTH']); $_SESSION['WEB_NO_AUTH'] = 1; headers::self(); } else { webUser::setAuth($userid); headers::self(); } } else { $_SESSION['WEB_NO_AUTH'] = 1; } }