35 lines
1.6 KiB
PHP
35 lines
1.6 KiB
PHP
<?
|
||
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1"));
|
||
$vip = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `comment` FROM `abils_user` WHERE `uid` = "'.$user['id'].'" LIMIT 1'));
|
||
$battle = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "'.$user['battle'].'" LIMIT 1'));
|
||
|
||
$t1 = explode(";", $battle['t1']);
|
||
if(in_array($user['id'], $t1)) {
|
||
$ttt = 1;
|
||
} else {
|
||
$ttt = 2;
|
||
}
|
||
|
||
if($user['battle'] == 0) {
|
||
echo'Нельзя использовать вне боя';
|
||
}
|
||
$_POST['target'] = htmlspecialchars($_POST['target']);
|
||
if($_POST['target'] == '' || $_POST['target'] == "") {
|
||
echo 'Текст не может быть пустым ...';
|
||
} elseif(preg_match("/__/", $_POST['target']) || preg_match("/--/", $_POST['target']) || strlen($_POST['target']) > 30) {
|
||
echo "В тексте не должно присутствовать подряд более 1 символа '_' или '-', или же текст больше 30 символов!";
|
||
} elseif($vip['comment'] <= 0) {
|
||
echo 'Магия исчерпала себя';
|
||
} else {
|
||
$mess = $_POST['target'];
|
||
if($user['sex'] == 1) {
|
||
$action = "выкрикнул";
|
||
} else {
|
||
$action = "выкрикнула";
|
||
}
|
||
$vip['comment'] -= 1;
|
||
if($user['invis'] == 1) { $lod = '<i><b>невидимка</b></i>'; } else { $lod = nick5($user['id'], "B".$ttt); }
|
||
addlog($user['battle'], '<span class=sysdate>'.date("H:i").'</span> '.$lod.' '.$action.': '.$mess.'<BR>');
|
||
mysql_query('UPDATE `abils_user` SET `comment` = "'.$vip['comment'].'" WHERE `id` = "'.$vip['id'].'" LIMIT 1');
|
||
}
|
||
?>
|