Browse Source

additional hash for ipb auth, #18

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@74 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
master
pzinovkin 16 years ago
parent
commit
7ee3a6edd1
  1. 22
      classes/User.class.php

22
classes/User.class.php

@ -42,9 +42,10 @@ class User
static function logout() static function logout()
{ {
Env::setCookie(session_name(), '', 0);
Env::setCookie('login', '', 0);
Env::setCookie('login_hash', '', 0);
Env::setCookie(session_name(), '', 0);
Env::setCookie('login', '', 0);
Env::setCookie('login_hash', '', 0);
Env::setCookie('login_ipbhash', '', 0);
if (session_id()) { if (session_id()) {
session_destroy(); session_destroy();
} }
@ -62,8 +63,10 @@ class User
static function setSession() static function setSession()
{ {
Env::setCookie('login', self::$user->login, TIME_NOW + LOGIN_COOKIE_TTL);
Env::setCookie('login_hash', self::getHash(), TIME_NOW + LOGIN_COOKIE_TTL);
$hash = self::getHash();
Env::setCookie('login', self::$user->login, TIME_NOW + LOGIN_COOKIE_TTL);
Env::setCookie('login_hash', $hash, TIME_NOW + LOGIN_COOKIE_TTL);
Env::setCookie('login_ipbhash', self::getIPBHash($hash), TIME_NOW + LOGIN_COOKIE_TTL);
@session_start(); @session_start();
@ -90,6 +93,15 @@ class User
return md5(self::$user->id.'hckrz'.self::$user->login.'mst'.self::$user->pass.'dai'); return md5(self::$user->id.'hckrz'.self::$user->login.'mst'.self::$user->pass.'dai');
} }
/**
* Создает хеш для проверки хеша в в IPB
*
*/
static public function getIPBHash($hash)
{
return md5($hash . strtolower(self::$user->login) . 'brainfuck');
}
static function getInfo() static function getInfo()
{ {
return Env::Session('user', self::$user); return Env::Session('user', self::$user);

Loading…
Cancel
Save