battles/magic/usability_klan/note.php

35 lines
1.6 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1"));
$vip = mysql_fetch_array(mysql_query('SELECT `id`, `klan`, `comment` FROM `abils_klan` WHERE `klan` = "'.$user['klan'].'" 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 = Nick::id($user['id'])->short(); }
2018-01-28 16:40:49 +00:00
addlog($user['battle'], '<span class=sysdate>'.date("H:i").'</span> '.$lod.' '.$action.': '.$mess.'<BR>');
mysql_query('UPDATE `abils_klan` SET `comment` = "'.$vip['comment'].'" WHERE `klan` = "'.$vip['klan'].'" LIMIT 1');
}