ad_connect_db("ads");
    if (empty($sort)) {
        $sort = "title";
    }
    $qh = ad_query("select * from ads order by {$sort},title");
    if (!$qh) {
        die("Database Error");
    }
    $nr = ad_queryrows($qh);
    $ct = 0;
    $i = 0;
    if ($nr > 0) {
        $array_hits_value = array();
        $array_clicks_value = array();
        while ($nr > $ct) {
            $ad = ad_fetch($qh);
            if ($ad['expiredate'] > $now) {
                ?>
					<tr>
						<td class="first style1">
<a href="?view=Stats&adid=<?php 
                echo $ad[adid];
                ?>
" class="first style1">- <?php 
                echo $ad[title];
                ?>
</a>
						</td>
						<td><?php 
                echo $ad[hits];
                ?>
示例#2
0
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 ($fp = fopen($ad_logpath_default . "/" . $r[logfile], "a+")) {
            $ca = getenv("REMOTE_HOST");
示例#3
0
         delete("ads", "adid", $delete);
     }
     if (!empty($activate)) {
         toggle_active("ads", "adid", $activate);
     }
     if (!empty($edit)) {
         include "edit.ad.php";
     } else {
         show_ads();
     }
     break;
 case "newdomain":
     ad_connect_db();
     ad_query("insert into domains set active = 'N'");
     $qh = ad_query("select last_insert_id() from domains");
     list($edit) = ad_fetch($qh);
     $new = TRUE;
     include "edit.domain.php";
     break;
 case "editdomain":
     if (!empty($delete)) {
         delete("domains", "domainid", $delete);
     }
     if (!empty($activate)) {
         toggle_active("domains", "domainid", $activate);
     }
     if (!empty($edit)) {
         include "edit.domain.php";
     } else {
         show_domains();
     }