battles/magic/usability_klan/travmoff.php
2019-01-16 19:45:30 +02:00

21 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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');
}