From 6e7a82b4254f8a437d8d9722dad088531a454c91 Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Wed, 3 May 2017 23:55:17 +0200 Subject: [PATCH] Fixed https://otland.net/threads/myaac-v0-0-1.251454/#post-2440110 --- system/libs/pot/OTS_Account.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index a0477a73..fcc4461c 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -885,7 +885,15 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable public function logAction($action) { - return $this->db->query('INSERT INTO ' . $this->db->tableName(TABLE_PREFIX . 'account_actions') . ' (' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('ip') . ', ' . $this->db->fieldName('date') . ', ' . $this->db->fieldName('action') . ') VALUES (' . $this->db->quote($this->getId()).', INET_ATON(' . $this->db->quote($_SERVER['REMOTE_ADDR']) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')'); + $ip = '127.0.0.1'; + if(isset($_SERVER['REMOTE_ADDR']) && !empty(($_SERVER['REMOTE_ADDR']))) + $ip = $_SERVER['REMOTE_ADDR']; + else if(isset($_SERVER['HTTP_CLIENT_IP']) && !empty(($_SERVER['HTTP_CLIENT_IP']))) + $ip = $_SERVER['HTTP_CLIENT_IP']; + else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty(($_SERVER['HTTP_X_FORWARDED_FOR']))) + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; + + return $this->db->query('INSERT INTO ' . $this->db->tableName(TABLE_PREFIX . 'account_actions') . ' (' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('ip') . ', ' . $this->db->fieldName('date') . ', ' . $this->db->fieldName('action') . ') VALUES (' . $this->db->quote($this->getId()).', INET_ATON(' . $this->db->quote($ip) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')'); } public function getActionsLog($limit1, $limit2)