<?php
/*
* This is a php frontend for mod_log_sql. It interfaces
* with the table structure as defined in a MySql database and has been
* tested only with version 1.16 of mod_log_sql.
*
* contact hide@address.com
*
*/
require("db-connect-apache.php");
require("apache-common.php");
$query = "select * from ".mysql_escape_string($dbs)." where remote_host='".$remoteHost."'".customFilter(1)." order by time_stamp desc";
$results=queryWithPage($query, $offset);
$statusRequest = mysql_query("select distinct(status) from ".mysql_Escape_string($dbs)." where remote_host='".$remoteHost."'".customFilter(1));
require("header.php");
?>
<center>
<table width="98%">
<tr>
<td align=center valign=top>
<table cellpadding="2" cellspacing=0 border=1 summary="Ip View">
<tr>
<td bgcolor=lemonchiffon><b>Request URI</b>.</td>
<td bgcolor=lemonchiffon><b>Status</b></td>
<td bgcolor=lemonchiffon><b>Bytes sent</b></td>
<td bgcolor=lemonchiffon><b>Time stamp</b></td>
</tr>
<?php
while($object = mysql_fetch_object($results)){
$totals += ($object -> bytes_sent);
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
'<a href="view-request.php?dbs='.$dbs.'&uri='.base64_encode($object->request_uri).'">'.getShortString($object->request_uri).'</a>',
//getShortString($object -> request_uri),
getStatusImage($object -> status),
getBytes($object -> bytes_sent),
myDate($object-> time_stamp)
);
}
print '<tr><td></td><td></td><td>'.getBytes($totals).'</td><td></td></tr>';
?>
</table>
<?php showPageNav($offset, $query, "&remoteHost=".$remoteHost); ?>
</td>
<td valign=top align=right>
<table border=1 cellpadding=2 cellspacing=0>
<tr>
<td colspan="2" bgcolor=lemonchiffon><b>Unique status recorded</b></td>
</tr>
<?php
while(list($aList)=mysql_fetch_array($statusRequest)){
print "<tr><td width=50 align=center>".getStatusImage($aList)."</td><td>".getHttpCode($aList)."</td></tr>";
}
print "<tr><td bgcolor=lemonchiffon colspan=2><b>Country</b></td></tr><tr><td colspan=2>".geoCountry($remoteHost)."</td></tr> ";
print "<tr><td bgcolor=lemonchiffon colspan=2><b>Browser(s)</b></td></tr>";
$array = getBrowser($remoteHost);
foreach($array as $item){
print "<tr><td colspan=2>".$item."</td></tr>";
}
?>
<?php require("cross-reference.php"); ?>
</table>
</td>
</tr>
</table>
</center>
<?php
require("footer.php");
?>