From 7ee3a6edd14d89b59cd456649ab74ed19bf64b5d Mon Sep 17 00:00:00 2001 From: pzinovkin Date: Tue, 14 Apr 2009 18:02:16 +0000 Subject: [PATCH] additional hash for ipb auth, #18 git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@74 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- classes/User.class.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/classes/User.class.php b/classes/User.class.php index 2cdef44..687204d 100644 --- a/classes/User.class.php +++ b/classes/User.class.php @@ -42,9 +42,10 @@ class User 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()) { session_destroy(); } @@ -62,8 +63,10 @@ class User 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(); @@ -89,6 +92,15 @@ class User { 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() {