/** * Add the connected IP to the list of IPs used to access the account * * @return boolean True unless an error occurred */ protected static function set_used_ip() { $account_data = \V1\Model\Account::get_account(); // No data if (empty($account_data)) { return false; } // If we can't decode the list, then we start fresh. Perhaps we overfilled the list of IPs somehow? if (empty($account_data['ips_used']) || !is_array($ips_used = json_decode($account_data['ips_used'], true))) { $ips_used = array(); } // Add the IP if it doesn't already exist. if (!in_array(\Input::real_ip(), $ips_used)) { $ips_used[] = \Input::real_ip(); \V1\Model\Account::set_used_ips($ips_used); } return true; }