コード例 #1
0
ファイル: visitors.php プロジェクト: sucof/footlocker
	function checkVisitor($userAgent, $ipAddress, $country)
		{
			
			$cq = new CQuery();
			
			$sql_result = mysql_query("SELECT 1 FROM " . $this->sqlSettings['tableVisitorsList'] . " LIMIT 0");
			if (!$sql_result)
			{
				echo "Error: Database table doesn't exist. Run install.php from the directory.";
				return;
			}
			
			$cq = new CQuery();
			
			$sql_result = mysql_query('SELECT ipAddress FROM ' . $this->sqlSettings['tableVisitorsList'] . ' WHERE ipAddress = \'' . $ipAddress . '\''); 
			$sql_rows = $cq->fetcharray($sql_result);
			mysql_free_result($sql_result);
			
			if($sql_rows) { 
				if($this->getIfVisitorExploitedByIp($ipAddress) == 1)
				{
					return true;
				} else {
					return false;
				}
			} else {
				$this->addUniqueVisitor($userAgent, $ipAddress, $country);
				return false;
			}
		}