View file cban.php

File size: 938B
<?php
include 'inc/db.php';
include 'inc/1.php';
$id=intval($_GET['id']);
if (!$_GET['id']){header("Location: /index.php");
exit;}
$ank=gus($id);
if ((($user['admin']==1) || ($user['moder']==1)) && ($ank['admin']==0)){
if (!$_POST['time']){
echo "<div class='input'><form action='?id=$id' method='POST'>Время*:<br><input type='text' name='time'><br>Причина:<br><textarea name='why'></textarea><br><input type='submit' name='OK' value='Бан'></form>*В часах.</div>";
}
else
{
$why=mysql_escape_string($_POST['why']);
$o=time();
$time=($o+(intval($_POST['time'])*3600));
if ($user['moder']==1){
if (intval($_POST['time'])>3)$pt=3;
$time=($o+($pt*3600));
}
mysql_query("INSERT INTO `ban` (`user`, `time`, `why`) values ('$id', '$time', '$why')");
echo "<div class='msg'>Пользователь забанен</div>";
}
}
else{
header("Location: /index.php");
exit;}
include 'inc/foot.php';
?>