From ee1bff8cd624bbf69f39deb5acd3e93862f91a95 Mon Sep 17 00:00:00 2001 From: lboullo0 Date: Mon, 5 Nov 2012 12:28:11 -0200 Subject: [PATCH] Update application/libraries/Bitauth.php replacing ip2long($_SERVER['REMOTE_ADDR']) by sprintf("%u", ip2long($_SERVER['REMOTE_ADDR'])) fix error on 32 machines where ip2long can return negative number. See note at: http://php.net/manual/en/function.ip2long.php --- application/libraries/Bitauth.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/libraries/Bitauth.php b/application/libraries/Bitauth.php index e130b9f..8218f04 100644 --- a/application/libraries/Bitauth.php +++ b/application/libraries/Bitauth.php @@ -147,7 +147,7 @@ public function login($username, $password, $remember = FALSE, $extra = array(), $data = array( 'last_login' => $this->timestamp(), - 'last_login_ip' => ip2long($_SERVER['REMOTE_ADDR']) + 'last_login_ip' => sprintf("%u", ip2long($_SERVER['REMOTE_ADDR'])) ); // If user logged in, they must have remembered their password. @@ -292,7 +292,7 @@ public function locked_out() } $query = $this->db - ->where('ip_address', ip2long($_SERVER['REMOTE_ADDR'])) + ->where('ip_address', sprintf("%u", ip2long($_SERVER['REMOTE_ADDR']))) ->where('success', 0) ->limit($this->_invalid_logins) ->order_by('time', 'DESC') @@ -324,7 +324,7 @@ public function log_attempt($user_id, $success = FALSE) { $data = array( - 'ip_address' => ip2long($_SERVER['REMOTE_ADDR']), + 'ip_address' => sprintf("%u",ip2long($_SERVER['REMOTE_ADDR'])), 'user_id' => (empty($user_id) ? 0 : $user_id), 'success' => (int)$success, 'time' => $this->timestamp()