<?php
require('db-connect-apache.php');
require('apache-common.php');
$topList=array(10, 15, 20, 25, 30, 40, 50, 60, 75, 80, 100);
if(is_null($no)){
$no=$summaryResults;
}
$query="select distinct(remote_host), count(*) as hits from ".$dbs.sensibleFilter(1).customFilter(1)." group by remote_host order by hits desc limit ".$no;
$top10hosts=mysql_query($query);
$query="select distinct(referer), count(*) as hits from ".$dbs.sensibleFilter(1).customFilter(1)." group by referer order by hits desc limit ".$no;
$top10referers=mysql_query($query);
$query="select distinct(request_uri), count(*) as hits from ".$dbs.sensibleFilter(1).customFilter(1)." group by request_uri order by hits desc limit ".$no;
$top10pages=mysql_query($query);
$query="select distinct(agent), count(*) as hits from ".$dbs.sensibleFilter(1).customFilter(1)." group by agent order by hits desc limit ".$no;
$top10browsers=mysql_query($query);
require('header.php');
?>
<center>
<form method=post>View top [
<?php print '<input type=hidden name=dbs value='.$dbs.' />'; ?>
<select name=no onchange="this.form.submit();">
<?php
while(list($key, $item)=each($topList)){
if($no==$item) {
print '<option selected=true value='.$item.'>'.$item.'</option>';
} else {
print '<option value='.$item.'>'.$item.'</option>';
}
}
?>
</select>
<input type=image src="resources/images/go.gif" value="Go" name="go" border=0 />
] results</form>
<table border=0>
<tr>
<td valign=top align=center>
<table border=1 cellspacing=0 cellpadding=2>
<tr><td colspan=2><b>Top <?php print $no ?> hosts</b></td></tr>
<tr><td bgcolor=lemonchiffon><b>Host</b></td><td bgcolor=lemonchiffon><b>Hits</b></td></tr>
<?php
while($list=mysql_fetch_object($top10hosts)){
print "<tr>";
print "<td><a href=\"view-host.php?dbs=".$dbs."&remoteHost=".$list->remote_host."\">".$list->remote_host."</a></td>";
print "<td>".$list->hits."</td>";
print "</tr>";
}
?>
</table>
</td>
<td valign=top align=center>
<table border=1 cellspacing=0 cellpadding=2>
<tr><td colspan=2><b>Top <?php print $no ?> referrers</b></td></tr>
<tr><td bgcolor=lemonchiffon><b>Referrer</b></td><td bgcolor=lemonchiffon><b>Hits</b></td></tr>
<?php
while($list=mysql_fetch_object($top10referers)){
print "<tr>";
print "<td>".getShortString($list->referer)."</td>";
print "<td>".$list->hits."</td>";
print "</tr>";
}
?>
</table>
</td>
</tr>
<tr>
<td valign=top align=center>
<table border=1 cellspacing=0 cellpadding=2>
<tr><td colspan=2><b>Top <?php print $no ?> page requests</b></td></tr>
<tr><td bgcolor=lemonchiffon><b>Page</b></td><td bgcolor=lemonchiffon><b>Hits</b></td></tr>
<?php
while($list=mysql_fetch_object($top10pages)){
print "<tr>";
print "<td><a href=\"view-request.php?dbs=".$dbs."&uri=".base64_encode($list->request_uri)."\">".getShortString($list->request_uri)."</a></td>";
print "<td>".$list->hits."</td>";
print "</tr>";
}
?>
</table>
</td>
<td valign=top align=center>
<table border=1 cellspacing=0 cellpadding=2>
<tr><td colspan=2><b>Top <?php print $no ?> browsers</b></td></tr>
<tr><td bgcolor=lemonchiffon><b>Browser</b></td><td bgcolor=lemonchiffon><b>Hits</b></td></tr>
<?php
while($list=mysql_fetch_object($top10browsers)){
print "<tr>";
print "<td>".$list->agent."</a></td>";
print "<td>".$list->hits."</td>";
print "</tr>";
}
?>
</table>
</td>
</tr>
</center>
<?php
require('footer.php');
?>