function phpAds_logConversion($userid, $trackerid) { global $HTTP_SERVER_VARS, $phpAds_config, $phpAds_geo; // Check if host is on list of hosts to ignore if ($host = phpads_logCheckHost()) { $log_country = $phpAds_config['geotracking_stats'] && $phpAds_geo && $phpAds_geo['country'] ? $phpAds_geo['country'] : ''; $log_host = $phpAds_config['log_hostname'] ? $HTTP_SERVER_VARS['REMOTE_HOST'] : ''; $log_host = $phpAds_config['log_iponly'] ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : $log_host; phpAds_dbQuery("INSERT " . ($phpAds_config['insert_delayed'] ? 'DELAYED' : '') . " INTO " . $phpAds_config['tbl_adconversions'] . "(userid" . ",trackerid" . ",host" . ",country)" . " VALUES " . "('" . $userid . "'" . "," . $trackerid . ",'" . $log_host . "'" . ",'" . $log_country . "')"); return phpAds_dbInsertID(); } }
function phpAds_logClick($bannerid, $clientid, $zoneid, $source) { global $phpAds_config, $phpAds_geo; if ($host = phpads_logCheckHost()) { $log_source = $phpAds_config['log_source'] ? $source : ''; if ($phpAds_config['compact_stats']) { // LOW PRIORITY UPDATEs are disabled until further notice - Matteo $result = phpAds_dbQuery("UPDATE " . (false && $phpAds_config['insert_delayed'] ? 'LOW_PRIORITY' : '') . " " . $phpAds_config['tbl_adstats'] . " SET clicks = clicks + 1 WHERE day = NOW() AND\n\t\t\t\thour = HOUR(NOW()) AND bannerid = '" . $bannerid . "' AND zoneid = '" . $zoneid . "' AND\n\t\t\t\tsource = '" . $log_source . "' "); if (phpAds_dbAffectedRows() == 0) { $result = phpAds_dbQuery("INSERT " . ($phpAds_config['insert_delayed'] ? 'DELAYED' : '') . " INTO " . $phpAds_config['tbl_adstats'] . " SET clicks = 1, views = 0, day = NOW(),\n\t\t\t\t\thour = HOUR(NOW()), bannerid = '" . $bannerid . "', zoneid = '" . $zoneid . "',\n\t\t\t\t\tsource = '" . $log_source . "' "); } } else { $log_country = $phpAds_config['geotracking_stats'] && $phpAds_geo && $phpAds_geo['country'] ? $phpAds_geo['country'] : ''; $log_host = $phpAds_config['log_hostname'] ? $_SERVER['REMOTE_HOST'] : ''; $log_host = $phpAds_config['log_iponly'] ? $_SERVER['REMOTE_ADDR'] : $log_host; $result = phpAds_dbQuery("INSERT " . ($phpAds_config['insert_delayed'] ? 'DELAYED' : '') . " INTO " . $phpAds_config['tbl_adclicks'] . " SET bannerid = '" . $bannerid . "', zoneid = '" . $zoneid . "',\n\t\t\t\thost = '" . $log_host . "', source = '" . $log_source . "', country = '" . $log_country . "' "); } phpAds_logExpire($clientid, phpAds_Clicks); } }