_db = $db; } /** * @param mixed $currentUserIp */ public function setCurrentUserIp($currentUserIp) { $this->currentUserIp = $currentUserIp; } /** * @param mixed $currentUserAgent */ public function setCurrentUserAgent($currentUserAgent) { $this->currentUserAgent = $currentUserAgent; } /** * @param mixed $currentUserReferer */ public function setCurrentUserReferer($currentUserReferer) { $this->currentUserReferer = $currentUserReferer; } /** * @return mixed */ public function getCurrentUserIp() { return $this->currentUserIp; } /** * @return mixed */ public function getCurrentUserAgent() { return $this->currentUserAgent; } /** * @return mixed */ public function getCurrentUserReferer() { return $this->currentUserReferer; } public function checkUniqueUser() { $this->_db->query("SELECT ip_adress, `timestamp` FROM sks_unique_user WHERE ip_adress = '{$this->getCurrentUserIp()}' ORDER BY `timestamp` ASC LIMIT 1"); $result = $this->_db->single(); $trackedDate = date("Y-m-d", $result['timestamp']); $currentDate = date("Y-m-d", time()); if ($trackedDate == $currentDate) { echo 'same Day visit'; } else { echo 'different Dates visit'; } } }