Размер файла: 1.92Kb
<?php
include "../ini.php";
@$p = $_GET['p'];
if ($p == ""){
$p = "list";
}
else;
switch ($p)
{
case 'list':
if ($pass_a == @$_REQUEST['pass']){
class Navigator
{
function __construct($all,$pnumber,$query='')
{
$this->all=$all;
$this->pnumber=$pnumber;
$this->query=$query;
$this->page=isset($_GET['page']) ? (int)$_GET['page'] : 1;
}
function start()
{
$this->num_pages=ceil($this->all/$this->pnumber);
if (isset($_GET['last']))
$this->page=$this->num_pages;
$this->start=$this->page*$this->pnumber-$this->pnumber;
if ($this->page > $this->num_pages || $this->page < 1)
{
$this->page=1;
$this->start=0;
}
return $this->start;
}
function navi()
{
if ($this->num_pages<2)
return '';
$buff='';
for($pr = '', $i =1; $i <= $this->num_pages; $i++)
{
$buff.=
$pr=(($i == 1 || $i == $this->num_pages || abs($i-$this->page) < 3) ? ($i == $this->page ? " [$i] " : ' <a href="'.$_SERVER['SCRIPT_NAME'].'?page='.$i.'&pass='.$_REQUEST['pass'].'">'.$i.'</a> ') : (($pr == ' ... ' || $pr == '')? '' : ' ... '));
}
return $buff.'';
}
}
$q=mysql_query(" SELECT count(*) FROM ban");
$all=mysql_result($q,0,0);
if ($all)
{
$n=new Navigator($all,$pnumber);
$q=mysql_query("SELECT * FROM ban ORDER BY id DESC LIMIT {$n->start()},$pnumber");
while (false!==($res=mysql_fetch_assoc($q)))
{
echo '<div class="post">';
echo '<a href="banlist.php?pass='.$_REQUEST['pass'].'&p=del&id='.$res['id'].'">[X]</a>';
echo ''.$res['ip'].'<br/>';
echo ''.$res['agent'].'</div>';
}
echo $n->navi();
}
echo "<a href=\"panel.php?pass=$pass_a\">Назад</a><br/>";
}
else echo "Неверный пароль";
break;
case 'del':
if ($pass_a === $_REQUEST['pass']){
mysql_query ('DELETE FROM `ban` WHERE `id`='.$_REQUEST['id'].';');
echo 'Разбанен<br/>
<a href="banlist.php?pass='.$_REQUEST['pass'].'&p=list">Назад</a><br/>';
}
else echo "Неверный пароль";
break;
}
?>
</body></html>