battles/magic/usability_vip/travmoff.php

22 lines
1.5 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?php
$us = mysql_fetch_array(mysql_query("SELECT *, (SELECT `id` FROM `online` WHERE `date` >= ".(time()-60)." AND `id` = `users`.`id`) AS `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1"));
$effect = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '{$us['id']}' AND `time` > '".time()."' AND (`type` = '11' OR `type` = '12' OR `type` = '13') ORDER BY `id` DESC LIMIT 1"));
$vip = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `travmoff` FROM `abils_vip` WHERE `uid` = "'.$user['id'].'" LIMIT 1'));
if($_POST['target'] != $user['login']) {
echo 'Вы можете излечить только себя';
} elseif($vip['travmoff'] <= 0) {
echo 'Магия была исчерпана ...';
} elseif($user['battle'] > 0) {
echo "Не в бою...";
} elseif(!isset($effect['id'])) {
echo "Нет тех травм, которые Вы можете излечить";
} else {
if($user['invis'] == 1) { $user['login'] = 'невидимка'; }
addch("<img src=i/sh/cure3.gif><b>{$user['login']}</b> излечил себя от травм.");
mysql_query('UPDATE `effects` SET `time` = "'.time().'" WHERE `id` = "'.$effect['id'].'" LIMIT 1');
echo "<font color=red><b>Персонаж \"{$_POST['target']}\" Был излечен от травм</b></font>";
$vip['travmoff'] -= 1;
mysql_query('UPDATE `abils_vip` SET `travmoff` = "'.$vip['travmoff'].'" WHERE `id` = "'.$vip['id'].'" LIMIT 1');
}
?>