Linksys Activity Logger - Temporary PHP Access


Home
Project Status/History
Documentation
LAL Logger
Source Installation

Logger Usage
Command Line Options
Temporary PHP Access

LAL Web
Installation
FAQ
Download
Screen Shots
Special Thanks  



SourceForge Logo

What is it?

NEW UPDATED 12/28/2001!!!  Added column titles and borders to make it more readable.

The following is a very simple php script/page that can be used to access the logged data in the database.  Since the current version of the logger only supports MySQL, this temporary page only supports MySQL as well.

Why is it considered temporary?  It's considered temporary because Daryl is working on a REALLY cool set of PHP pages that will provide a LOT of functionality.  This is being supplied in the meantime because I'm lazy and would like an easier way of accessing my data than using the MySQL command line interface.

Simple copy the code below, and save it as a file name 'linksysactivity.php'.  If you used a different name other than 'linklogger' for the user account used to access the data, or specified a different password than 'linklogger', change the line containing the 'mysql_pconnect' call.  The first paramter is the machine the database is on (typically the same machine the web server is on), the second is the username, and the third is the password.  The script/page provided here is based upon the examples given during the installation instructions.

Anyhow, this just displays some basic information.  Time permitting I may make it look better, so check back periodically.  Otherwise just wait for Daryl's cool version.

--------------------------------------------------linksysactivity.php starts here-----------------------------------------
</head>
<body>
<h1>Activity Logged by Linksys Activity Logger (LAL)</h1>
<?
@ $db_connection = mysql_pconnect("localhost", "linklogger", "linklogger");

if (!$db_connection) {
    echo "Error:  Unable to connect to mySQL database.";
    exit;
}

mysql_select_db("linklogger");

$mySQLSelect = "SELECT lnklgr_date_tx, lnklgr_src_ip_tx, lnklgr_src_hstnm_tx, lnklgr_dst_prt_nr FROM linklogger";

$myResultSet = mysql_query($mySQLSelect);

$myRecordCount = mysql_num_rows($myResultSet);

echo "Number of records in database: ".$myRecordCount."</p>";

echo "<table border=1>";
echo "<tr>";
echo "<td></td><td><b>Date/Time</b></td>";
echo "<td><b>Resolved Source Hostname</b></td>";
echo "<td><b>Source IP</b></td>";
echo "<td><b>Dest port</b></td>";
echo "</tr>";

for ($myLoop = 0; $myLoop < $myRecordCount; $myLoop++) {
    $myRow = mysql_fetch_array($myResultSet);
    echo "<tr>";
    echo "<td><b>".($myLoop + 1)."</b></td>";
    echo "<td>".$myRow["lnklgr_date_tx"]."</td> ";
    echo "<td>".$myRow["lnklgr_src_hstnm_tx"]."</td> ";
    echo "<td>".$myRow["lnklgr_src_ip_tx"]."</td> ";
    echo "<td>".$myRow["lnklgr_dst_prt_nr"]."</td>";
    echo "</tr>";
}
echo "</table>";

?>
</body>
</html>

-----------------------------------------linksysactivity.php ends here -------------------------------------------------