include "ads.lib"; global $ad_logpath_default; if (isset($_GET['ad'])) { $ad = strip_tags($_GET['ad']); } // Abort if no ad ID was passed if (empty($ad)) { echo "<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY><H1>Error</H1>"; echo "<H4>This script cannot be accessed directly.</H4></BODY></HTML>"; return; } $dt = strftime("%Y-%m-%d %H:%M:%S", time()); $site = ad_getsite($p); ad_connect_db("db"); $qh = ad_query("select * from ads where adid = '{$ad}'"); $nr = ad_queryrows($qh); if ($nr > 0) { $r = ad_fetch($qh); } else { return; } // Add entry to mysql log $qh = ad_query("insert into adlog SET " . "adid = '{$r['adid']}'," . "type = 'click'," . "remotehost = '{$REMOTE_HOST}'," . "remoteaddr = '{$REMOTE_ADDR}'," . "site = '{$site['name']}'," . "entrydate = '{$dt}'"); // Update Information (unless localhost) if (!ad_is_localhost()) { // Update click count $r[clicks] = $r[clicks] + 1; $qh = ad_query("update ads SET clicks = '{$r['clicks']}' WHERE adid = '{$ad}'"); // If logfile is not empty, make an entry // Format: YYYY-MM-DD HH:MM:SS CLICK|HIT domain clientaddress if (!empty($r[logfile])) {
if (empty($edit)) { return; } ad_connect_db("db"); if ($B1 == "Cancel") { if ($new) { ad_query("delete from ads where adid = '{$edit}'"); $new = FALSE; } $edit = ""; include "admin.php"; return; } if (empty($B1)) { $qh = ad_query("select * from ads where adid = '{$edit}'"); if (ad_queryrows($qh) > 0) { $r = ad_fetch($qh); } else { return; } } else { qpe(&$title, &$banner, &$url, &$trackingurl, &$logfile, &$textad, &$textadurl, &$notes); $domains = implode("|", $domains); if ($logtype != NULL) { $logtype = join(",", $logtype); } else { $logtype = ""; } if (strtoupper($updmodifydate) == 'ON') { $modifydate = strftime("%Y-%m-%d %H:%M:%S", time()); }