<?php
class Timer {
var $startTime;
var $endTime;
function start() {
$this->startTime = gettimeofday();
}
function stop() {
$this->endTime = gettimeofday();
}
function elapsed() {
return (($this->endTime["sec"] - $this->startTime["sec"]) * 1000000 + ($this->endTime["usec"] - $this->startTime["usec"])) / 1000000;
}
}
$timer = new Timer();
$timer->start();
session_start();
include("../settings-data.php");
include("../lib.php");
checkPermissions($login, $password);
include("../banned-ip-data.php");
if (!isset($id))
$id = "";
for($i = 0; $i < sizeof($id); $i++)
{
if (!isset($banned[$id[$i]-1]))
{
session_destroy();
Header("Location: login.php");exit;
}
$banned[$id[$i]-1] = "";
}
$newContent = "<?php\n";
for($i = 0; $i < sizeof($banned); $i++)
{
if ($banned[$i] != "")
$newContent .= "\t\$banned[] = \"".$banned[$i]."\";\n";
}
$newContent .= "?>";
reWriteDataInFile ($newContent,"../banned-ip-data.php");
$timer->stop();
Header("Location: ip-ban.php?".$timer->elapsed());exit;
?>