Файл: groups/adm/ban.php
Строк: 107
<?php
require_once '../../incfiles/core.php';
require_once '../../incfiles/func.php';
require_once '../../incfiles/auth.php';
require_once '../../incfiles/user.php';
if (empty($user_id)) go(URL);
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
$result = mysql_query("SELECT * FROM `groups` WHERE `id` = '".$id."' LIMIT 1");
if (mysql_num_rows($result) == true) $arr_group = mysql_fetch_array($result);
else go(URL);
if (!in_array($user_id, explode("||", substr($arr_group['admins'], 1, -1))) && !in_array($user_id, explode("||", substr($arr_group['moders'], 1, -1)))) go(URL);
}
else go(URL);
if (!empty($_GET['ban_id']) && is_numeric($_GET['ban_id'])) $ban_id = abs(intval($_GET['ban_id']));
if ($user_id == $ban_id || !in_array($ban_id, explode("||", substr($arr_group['users'], 1, -1))) || in_array($ban_id, explode("||", substr($arr_group['banlist'], 1, -1))) || in_array($ban_id, explode("||", substr($arr_group['admins'], 1, -1))) || in_array($ban_id, explode("||", substr($arr_group['moders'], 1, -1)))) go(URL);
$title = lang('Блокиррование пользователя','Блокування користувача');
require_once '../../incfiles/head.php';
echo '<div class="title">'.$title.'</div>';
if (!empty($_POST['do']) && is_numeric($_POST['do']))
{
$do = abs(intval($_POST['do']));
$text = check($_POST['text']);
if ($do == 1) $do_time = time()+3600;
else if ($do == 2) $do_time = time()+3600*6;
else if ($do == 3) $do_time = time()+3600*24;
else if ($do == 4) $do_time = time()+3600*24*7;
else if ($do == 5) $do_time = time()+3600*24*7*2;
else if ($do == 6) $do_time = time()+3600*24*7*4;
else $do_time = time()+3600;
if (mysql_query("UPDATE `groups` SET `admins` = '".str_replace("|".$ban_id."|", "", $arr_group['admins'])."', `moders` = '".str_replace("|".$ban_id."|", "", $arr_group['moders'])."', `banlist` = '|".$ban_id."|".$arr_group['banlist']."' WHERE `id` = '".$id."'") == true)
{
mysql_query("INSERT INTO `groups_ban` SET `group_id` = '".$id."', `ban_id` = '".$ban_id."', `text` = '".$text."', `do` = '".$do_time."', `time` = '".time()."'");
echo ok(user_name3($ban_id).Lang(' заблокирован',' заблокований'));
require_once '../../incfiles/foot.php'; exit;
}
}
?>
<script type="text/javascript">
$(function(){
$('#form').on('submit', function(e){
Page.Loading('start');
e.preventDefault();
var $that = $(this),
formData = new FormData($that.get(0));
$.ajax({
url: $that.attr('action'),
type: $that.attr('method'),
contentType: false,
processData: false,
data: formData,
success: function(response){
if(response){
Page.Loading('stop');
$('.content').html(response);
}
}
});
});
});
</script>
<?
echo '<div class="block2">'.user_name($ban_id).'<br/><br/></div>
<form id="form" method="post" action="'.URL.'/groups/adm/ban.php?id='.$id.'&ban_id='.$ban_id.'">
<div class="block">
'.lang('Заблокировать на','Заблокувати на').':
<select class="input2" name="do">
<option value="1">1 '.lang('час','годину').'</option>
<option value="2">6 '.lang('часов','годин').'</option>
<option value="3">24 '.lang('часа','години').'</option>
<option value="4">1 '.lang('неделю','тиждень').'</option>
<option value="5">2 '.lang('недели','тижні').'</option>
<option value="6">4 '.lang('недели','тижні').'</option>
</select>
</div><div class="block">
Причина:<br/>
<input class="input" type="text" name="text" value=""/>
</div><div class="block">
<input class="button2" type="submit" value="'.lang('Заблокировать','Заблокувати').'"/>
</div>
</form>';
require_once '../../incfiles/foot.php';
?>