<?php require("head.php");?>
<center>
<form method='POST' action='showlog.php'>
<input type='submit' name='clear' value='Clear All' />
</form>
</center>
<?php require("config.php");
//\\\\\\\\\\YOU CAN CHANGE WITHIN THE 's TO ALTER THE WAY THE TIME IS DISPLAYED\\\\\\\\\\
//\\\\\\\\\\ONLY EDIT IT IF YOU KNOW WHAT YOU'RE DOING!\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
$time = date('d/m/Y h:i:s A');
//\\\\\\\\\\DO NOT EDIT BELOW!\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
if (isset($_POST['clear']))
{
mysql_query("TRUNCATE TABLE log") or die(mysql_error());
echo "<center><b>All log information cleared!</b></center>";
//Update when it was last cleared
mysql_query("UPDATE lastcleared SET TimeLC = '" . $time . "'
WHERE ID = '1'") or die(mysql_error());
}
$data = mysql_query("SELECT * FROM log ORDER BY ID DESC");
echo "<center><p>Log last cleared: ";
//Output time when it was last cleared
$dataLC = mysql_query("SELECT * FROM lastcleared");
$rowLC = mysql_fetch_array($dataLC);
echo $rowLC['TimeLC'];
echo "</p></center>";
echo "<center><table border='1'>
<tr>
<th>IP</th>
<th>Time</th>
<th>Page</th>
<th>Details</th>
</tr>";
while($row = mysql_fetch_array($data))
{
echo "<tr>";
echo "<td>" . $row['IP'] . "</td>";
echo "<td>" . $row['Time'] . "</td>";
echo "<td>" . $row['Page'] . "</td>";
echo "<td>" . $row['Details'] . "</td>";
echo "</tr>";
}
echo "</table></center>";
mysql_close($connect);
?>