From 42e3d7a11eafcda71060309a074c0282187ff6c7 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Wed, 6 May 2015 01:00:02 +0000 Subject: [PATCH] New features --- kernel/login.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/kernel/login.class.php b/kernel/login.class.php index c629ec34..be94885f 100644 --- a/kernel/login.class.php +++ b/kernel/login.class.php @@ -32,7 +32,8 @@ class Login { if(Session::get('fingerPrint')===$this->fingerPrint()) { $username = Session::get('username'); - if(!empty($username)) { + + return (!empty($username)) { return true; } } @@ -45,12 +46,14 @@ class Login { $username = trim($username); $password = trim($password); - if(empty($username) || empty($password)) + if(empty($username) || empty($password)) { return false; + } $user = $this->dbUsers->get($username); - if($user==false) + if($user==false) { return false; + } $passwordHash = sha1($password.$user['salt']); @@ -68,8 +71,9 @@ class Login { { // User agent $agent = getenv('HTTP_USER_AGENT'); - if(empty($agent)) + if(empty($agent)) { $agent = 'Bludit/1.0 (Mr Nibbler Protocol)'; + } // User IP if(getenv('HTTP_X_FORWARDED_FOR')) @@ -79,8 +83,9 @@ class Login { else $ip = getenv('REMOTE_ADDR'); - if($random) + if($random) { return sha1(mt_rand().$agent.$ip); + } // DEBUG: Ver CLIENT IP, hay veces que retorna la ip ::1 y otras 127.0.0.1 return sha1($agent);