Файл: prison.php
Строк: 38
<?php
require 'sys/sid.php';
require 'sys/config.php';
include 'sys/user.php';
include 'sys/head.php';
include 'sys/navigator.php';
visit(0, 'prison');
if (isset($_GET['free']))
{
$free = trim(mysql_real_escape_string(char($_GET['free'], 0)));
$ctrl = mysql_query("SELECT nick FROM users WHERE nick = '$free' AND ban > '$rtime' LIMIT 1");
if ($user['level'] != 2)
{
header('location: prison.php');
die();
}
elseif (mysql_num_rows($ctrl) == false)
{
err('Игрок не арестован или его не существует!');
}
else
{
mysql_query("UPDATE users SET ban = '', forever = '0', why = '' WHERE nick = '$free' LIMIT 1");
msg('Игрок освобжден.');
}
}
$sql = mysql_result(mysql_query("SELECT COUNT(*) FROM users WHERE ban > '$rtime'"), 0);
if ($sql != 0)
{
echo 'В тюрьме ' . $sql . ' чел.<br/>';
$n = new navigator($sql, 10, '&');
$view = mysql_query("SELECT nick, why, ban, forever FROM users WHERE ban > '$rtime' ORDER BY ban DESC {$n->limit}");
echo '<div style="padding:5px;margin:2px;">';
while($a = mysql_fetch_assoc($view))
{
if ($user['level'] == 2) $free = '<a href="freeprison_'.$a['nick'].'"><span style="color:#00AA00;">[осв]</span></a>';
$term = ($a['forever'] == 0) ? 'до освобождения ' . val($a['ban'] - $rtime) : 'пожизенно';
echo '<div style="border:1px dotted #FF3030;"><a href="userinfo_'.$a['nick'].'">' . $a['nick'] . '</a> ' . $free . '<br/>
→ ' . $term . ' | ' . $a['why'] . '</div><br/>';
}
echo $n->navi() . '</div>';
} else echo 'Тюрьма пустая.<br/>';
echo '<br/><a href="/">На главную</a>';
include 'sys/foot.php';
?>