public static function getUser() { $uid = Utils\Cookie::get('uid'); $key = Utils\Cookie::get('key'); if ($uid == null) { $user = new User(); $user->isLogin = false; return $user; } $user = User::find($uid); if ($user == null) { $user->isLogin = false; return $user; } if (Hash::cookieHash($user->pass) != $key) { $user->isLogin = false; return $user; } $user->isLogin = true; return $user; }
public function testCookieHash() { $str = Tools::genRandomChar(); Hash::cookieHash($str); }