Location: PHPKode > projects > logViewSQL > apache/view-ip.php
<?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 distinct(remote_host), count(*) as requests, min(time_stamp) as mintime, max(time_stamp) as maxtime, sum(bytes_sent) as bytes from ".mysql_escape_string($dbs).sensibleFilter(1).customFilter(1)." group by remote_host order by requests desc");
    $results = queryWithPage($query, $offset);
    require("header.php");   
    ?>
    <center>
        <table cellpadding="2" cellspacing=0 border=1 summary="All Ip's">
            <tr>                
                <td bgcolor=lemonchiffon><b>IP</b></td>
                <td bgcolor=lemonchiffon><b>Requests</b></td>
                <td bgcolor=lemonchiffon><b>First Hit</b></td>
                <td bgcolor=lemonchiffon><b>Last Hit</b></td>
		<td bgcolor=lemonchiffon><b>Bytes sent</b></td>
            </tr>
            <?php
	    $totalBytes = 0;
            while($object = mysql_fetch_object($results)){                
		$totalBytes+=($object->bytes);
		$totalConnections+=($object -> requests);
                printf("<tr><td>(%s) <a href=\"view-host.php?dbs=".$dbs."&remoteHost=%s\">%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",                
		geoCode($object -> remote_host),
                $object -> remote_host,
		$object -> remote_host,
                $object -> requests,
                myDate($object-> mintime),
                myDate($object-> maxtime),
		getBytes($object->bytes)
                );
            }
	    print "<tr><td></td><td>$totalConnections</td><td></td><td></td><td>".getBytes($totalBytes)."</td></tr>";
            ?>
        </table>
	<?php showPageNav($offset, $query, null); ?>
	</center>
<?php require("footer.php");

Return current item: logViewSQL