battles/magic/haos_off.php
2018-01-28 18:40:49 +02:00

48 lines
2.1 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
// magic идентификацыя
//if (rand(1,2)==1) {
if ($_SESSION['uid'] == null) header("Location: index.php");
$tar = mysql_fetch_array(mysql_query("SELECT `id`,`align` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
$target=$_POST['target'];
if ($tar['id']) {
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '4' LIMIT 1;"));
if ($effect['time']) {
$ok=0;
if (($user['align'] > '2' && $user['align'] < '3') || ($user['align'] == '1.99')|| ($user['align'] == '1.98')) {
$ok=1;
}
if ($ok == 1) {
if (mysql_query("DELETE FROM `effects` WHERE `owner` = '{$tar['id']}' and `type` = '4' LIMIT 1 ;")) {
mysql_query("UPDATE `users` SET `palcom` = '',`align`='0' WHERE `id` = {$tar['id']} LIMIT 1;");
if ($user['sex'] == 1) {$action="выпустил";}
else {$action="выпустила";}
if ($user['align'] > '2' && $user['align'] < '3') {
$angel="Ангел";
}
elseif ($user['align'] > '1' && $user['align'] < '2') {
$angel="Паладин";
}
$mess="$angel &quot;{$user['login']}&quot; $action из хаоса &quot;$target&quot;..";
mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');");
mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');");
addch("<img src=i/magic/haos_off.gif> $mess");
echo "<font color=red><b>Успешно снято заклятие хаоса с персонажа \"$target\"</b></font>";
}
else {
echo "<font color=red><b>Произошла ошибка!<b></font>";
}
}
else {
echo "<font color=red><b>Вы не можете снять заклятие хаоса с этого персонажа!<b></font>";
}
}
else {
echo "<font color=red><b>На персонаже \"$target\" нет заклятия хаоса </b></font>";
}
}
else {
echo "<font color=red><b>Персонаж \"$target\" не существует!<b></font>";
}
?>