1: <?php
2: namespace Opencart\Catalog\Model\Tool;
3: /**
4: * Class Online
5: *
6: * @package Opencart\Catalog\Model\Tool
7: */
8: class Online extends \Opencart\System\Engine\Model {
9: /**
10: * Add Online
11: *
12: * @param string $ip
13: * @param int $customer_id
14: * @param string $url
15: * @param string $referer
16: *
17: * @return void
18: */
19: public function addOnline(string $ip, int $customer_id, string $url, string $referer): void {
20: $this->db->query("DELETE FROM `" . DB_PREFIX . "customer_online` WHERE `date_added` < '" . date('Y-m-d H:i:s', strtotime('-' . (int)$this->config->get('config_customer_online_expire') . ' hour')) . "'");
21:
22: $this->db->query("REPLACE INTO `" . DB_PREFIX . "customer_online` SET `ip` = '" . $this->db->escape($ip) . "', `customer_id` = '" . (int)$customer_id . "', `url` = '" . $this->db->escape($url) . "', `referer` = '" . $this->db->escape($referer) . "', `date_added` = '" . $this->db->escape(date('Y-m-d H:i:s')) . "'");
23: }
24: }
25: