function stats($what)
{
global $phpAds_db, $phpAds_url_prefix;
$result = db_query("
SELECT
*,
DATE_FORMAT(t_stamp, '$GLOBALS[time_format]') as t_stamp_f,
DATE_FORMAT(t_stamp, '%H') as hour,
count(*) as qnt
FROM
$what
WHERE
bannerID = $GLOBALS[bannerID]
AND DATE_FORMAT(t_stamp, '$GLOBALS[date_format]') = '$GLOBALS[day]'
GROUP BY
hour
") or mysql_die();
$max = 0;
$total = 0;
while ($row = mysql_fetch_array($result))
{
if ($row["qnt"] > $max)
$max = $row["qnt"];
$total += $row["qnt"];
}
@mysql_data_seek($result, 0);
$i = 0;
while ($row = mysql_fetch_array($result))
{
$bgcolor="#F7F7F7";
$i % 2 ? 0: $bgcolor= "#ECECFF";
$i++;
?>
|
:00 |
" height="11"> " height="11">
|
print $row["qnt"];
?>
|
}
}
?>
print "| $strViews: | ";
stats("$phpAds_tbl_adviews");
print "| $strClicks: | ";
stats("$phpAds_tbl_adclicks");
?>
if (!$phpAds_compact_stats) {
print "| $strTopTenHosts: | ";
$result = db_query("
SELECT
*,
count(*) as qnt
FROM
$phpAds_tbl_adviews
WHERE
bannerID = $GLOBALS[bannerID]
AND DATE_FORMAT(t_stamp, '$GLOBALS[date_format]') = '$GLOBALS[day]'
GROUP BY
host
ORDER BY
qnt DESC
LIMIT 10
") or mysql_die();
$i = 0;
while ($row = mysql_fetch_array($result))
{
$bgcolor="#F7F7F7";
$i % 2 ? 0: $bgcolor= "#ECECFF";
$i++;
?>
|
|
|
}
}
?>
|