From 6a5f9388954673d8130a8a3de317639e042017f4 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 13 Jun 2013 13:46:32 +0200 Subject: [PATCH] Store Users IP address in accounts after login Fixes #177 --- public/include/classes/user.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/include/classes/user.class.php b/public/include/classes/user.class.php index cc8d7c70..9e69b01d 100644 --- a/public/include/classes/user.class.php +++ b/public/include/classes/user.class.php @@ -69,7 +69,6 @@ class User { ); return $this->updateSingle($id, $field); } - public function setUserToken($id) { $field = array( 'name' => 'token', @@ -78,6 +77,10 @@ class User { ); return $this->updateSingle($id, $field); } + private function setUserIp($id, $ip) { + $field = array( 'name' => 'loggedIp', 'type' => 's', 'value' => $ip ); + return $this->updateSingle($id, $field); + } /** * Fetch all users for administrative tasks @@ -106,6 +109,7 @@ class User { } if ( $this->checkUserPassword($username, $password)) { $this->createSession($username); + $this->setUserIp($this->getUserId($username), $_SERVER['REMOTE_ADDR']); return true; } $this->setErrorMessage("Invalid username or password");