Hi:
I made some progress on how to refresh the page after the user has submitted new hours and failures parameters. I simply put "http://enterprise/~benzino/final.php?$hours=hours
However, as I'm told this should work. I receive a Illegal hours parameter after the page refreshes. What is the dilly? I just need the page to refresh under the new altered values!! someone help me please!! -Colforbin
$hours = $_REQUEST["hours"];
// If it wasn't specified, we default it.
// Check the syntax.
if (! $hours) $hours = 2;
// Check the syntax.
ereg('[1-9][0-9]*$', $hours) or die("Illegal HOURS parameter.");
// Also see how many failures must exist before we flag as "red".
$failures = $_REQUEST["failures"];
if (! $failures) $failures = 5;
ereg('[1-9][0-9]*$', $failures) or die("Illegal FAILURES parameter.");
// When refreshing, make sure we pass non-default values back to the
// script, else we lose the changes.
$urlappend = ($hours != 2) ? "&hours={$hours}" : "";
if ($failures != 5) $urlappend .= "&failures={$failures}";
// OK, let's query the database.
// These variables are defined in ./authenticate.inc
if (!($db = mysql_connect($db_host, $db_user, $db_pass)))
die("SQL Server unavailable; try again later.");
if (!mysql_select_db("ntsyslog", $db))
die("No NTSysLog SQL database???");
$eid="SELECT primary_uname, COUNT(*) AS uname_count, MIN(stamp), MAX(stamp) " .
"FROM nteventlog WHERE stamp > NOW() - INTERVAL {$hours} HOUR " .
"AND event IN (529, 535, 539) GROUP BY primary_uname " .
"HAVING uname_count > {$failures} ORDER BY uname_count DESC";
if (!($eid = mysql_query($eid, $db)))
die("Can't run SQL query?");
// Fetch all the data and put it in an array called "rows".
while(($x = mysql_fetch_row($eid))) $rows[] = $x;
// Finish up by freeing the data structure and closing the DB connection.
mysql_free_result($eid);
mysql_close($db);
// OK, we have all our data now in "rows[]" and the database is closed down.
// Now generate the HTML.
// Each of the rows is itself an array, where the four values are
// (from the SQL query): uname, count, min_stamp and max_stamp.
?>
<HTML>
<Head>
<Title>Failed Login attempts</Title>
<Meta NAME= "Author" CONTENT= "Benjamin J. Paradis">
<Meta NAME= "Robots" CONTENT= "NoIndex, NoFollow">
<Meta HTTP-EQUIV="refresh" CONTENT="10; URL='http://enterprise/~benzino/final.php?hours=$hours'">
<LINK REL="stylesheet" TYPE="text/css" HREF="final.css">
</Head>