battles/magic/usability_klan/travmoff.php

21 lines
1.4 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` = '13' ORDER BY `id` DESC LIMIT 1"));
$vip = mysql_fetch_array(mysql_query('SELECT `id`, `klan`, `travmoff` FROM `abils_klan` WHERE `klan` = "'.$user['klan'].'" LIMIT 1'));
if($vip['travmoff'] <= 0) {
echo 'Магия была исчерпана ...';
} elseif($user['battle'] > 0) {
echo "Не в бою...";
} elseif(!isset($effect['id'])) {
echo "Нет тех травм, которые Вы можете излечить";
} else {
if($user['invis'] == 1) { $user['login'] = 'невидимка'; }
if($us['invis']== 1) { $us['login'] = 'невидимка'; }
addch("<img src=i/sh/cure3.gif><b>{$user['login']}</b> излечил $us[login] от травм.");
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_klan` SET `travmoff` = "'.$vip['travmoff'].'" WHERE `klan` = "'.$vip['klan'].'" LIMIT 1');
}
?>