Размер файла: 2.34Kb
<?php
//////////////////////////
// Автор: -=Storm=- //
// Сайт: xwap.nov.ru //
// icq: 4073300 //
//////////////////////////
include "../ini.php";
if ($pass_a === @$_REQUEST['pass']){
echo '<div>Админка</div>';
echo "<a href=\"del.php?pass=$pass_a&page=all\">Очистить гостевую</a>";
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 posts");
$all=mysql_result($q,0,0);
if ($all)
{
$n=new Navigator($all,$pnumber);
$q=mysql_query("SELECT * FROM posts ORDER BY id DESC LIMIT {$n->start()},$pnumber");
while (false!==($res=mysql_fetch_assoc($q)))
{
echo '<div class="post">';
echo '<a href="del.php?pass='.$pass_a.'&page=one&id='.$res['id'].'">[X]</a><b>'.$res['name'].'</b> <small>(';
echo ''.$res['time'].')</small><br/>';
echo ''.$res['post'].'<br/><small>';
echo ''.$res['ip'].'<br/>';
echo ''.$res['mob'].'</small>';
if ($res['otvet']) echo '<br/><u>Ответ: '.$res['otvet'].'</u>';
else;
echo '<br/><a href="otv.php?pass='.$_REQUEST['pass'].'&id='.$res['id'].'">[отв.]</a>|<a href="ban.php?pass='.$_REQUEST['pass'].'&id='.$res['id'].'">[бан]</a>';
echo '</div>';
}
echo $n->navi();
echo "<br/>Всего сообщений: $all<br/>";
$b = mysql_query(" SELECT count(*) FROM ban");
$allb = mysql_result($b,0,0);
echo '<a href="banlist.php?pass='.$_REQUEST['pass'].'">Забаненых ('.$allb.')</a><br/>';
}}
else echo "Неверный пароль!";
?>
</body></html>