File size: 2.95Kb
<?php
include_once("../incs/conf.php");
include_once("../incs/fmysql.php");
include_once("../incs/fnc2.php");
include_once("../incs/head2.php");
head("Админ панель - Бан",$meuser,$auth);
if($on==1 && $user[level]>=2){
echo "<div class='rowup'>";
include_once("../incs/title2.php");
echo "<a href=\"index.php\">Админ панель</a> - Бан</div>";
$id=fil($_GET['id']);
$act=fil($_GET['act']);
switch($act){
case'spis':
if($id!="" && $user[level]>=9){
mysql_query("UPDATE `user` SET `ban` = '0' WHERE `id` = '$id'");
}
$spis_ban_user = mysql_num_rows(mysql_query("SELECT id FROM `user` WHERE `ban` > 'time'"));
if ($spis_ban_user==0){
echo "Нет забаненых<br/>\n";
}
$spis_ban=mysql_query("SELECT * FROM `user` WHERE `ban` > 'time()'");
while ($ban_sposok = mysql_fetch_array($spis_ban))
{
if($num==1){
echo "<div class='reki'>";
$num=0;
}else{
echo "<div class='rek'>";
$num=1;}
echo "<a href=\"../my.php?id=$ban_sposok[id]\">$ban_sposok[nick]</a>";
if($user[level]>=9){
echo " - <a href=\"?act=spis&id=$ban_sposok[id]\">Снять бан</a>";
}
echo "</div>";
}
include_once("../incs/down2.php");
break;
}
$ban=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$id'"));
if (isset($_POST['ban_prich']) && isset($_POST['time']) && isset($_POST['vremja']))
{
if($ban[level]<=1){
$time_ban=0;
if($_POST['vremja']=='min'){$time_ban=intval($_POST['time'])*60;}
if($_POST['vremja']=='chas'){$time_ban=intval($_POST['time'])*60*60;}
if($_POST['vremja']=='sut'){$time_ban=intval($_POST['time'])*60*60*24;}
if($_POST['vremja']=='mes'){$time_ban=intval($_POST['time'])*60*60*24*30;}
$ban_user=time()+$time_ban;
$prichina=filtr($_POST['ban_prich']);
$prichina=smiles($prichina);
mysql_query("UPDATE `user` SET `ban` = '$ban_user', `ban_prich` = '$prichina' WHERE `id` = '$ban[id]' LIMIT 1");
echo "Пользователь успешно забанен<br>";
}else{
echo "Нельзя банать администрацию<br>";
}
}
$ban_user_k=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$id'"));
echo "<form action=\"ban.php?id=$id\" method=\"post\">";
echo "Причина бана пользователя <a href=\"../my.php?id=$ban_user_k[id]\"><b>$ban_user_k[nick]</b></a>:<br><input type=\"text\" name=\"ban_prich\" title=\"Причина бана\" value=\"$ban[ban_prich]\" maxlength=\"300\" /><br>";
echo "Время бана:<br><input type=\"text\" name=\"time\" title=\"Время бана\" value=\"10\" maxlength=\"11\" /><br>";
echo "<select class=\"form\" name=\"vremja\">";
echo "<option value=\"min\">Минут</option>";
echo "<option value=\"chas\">Часов</option>";
echo "<option value=\"sut\">Суток</option>";
echo "<option value=\"mes\">Месяцов</option>";
echo "</select><br>";
echo "<input type=\"submit\" value=\"Забанить\" />";
echo "</form>";
include_once("../incs/down2.php");
}else{
echo "<div class='rowup'>";
include_once("../incs/title2.php");
echo "Админ панель - Бан</div>";
echo "Извени, но тебе здесь находитса нельзя!<br>";
}
include_once("../incs/down2.php");
?>