battles/magic/unmarry.php
2018-11-01 12:40:06 +02:00

31 lines
2.2 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
if ($_SESSION['uid'] == null) header("Location: index.php");
$m = mysql_fetch_array(mysql_query("SELECT `id`,`align`,`married`,`login` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
$w = mysql_fetch_array(mysql_query("SELECT `id`,`align`,`married`,`login` FROM `users` WHERE `login` = '{$_POST['target1']}' LIMIT 1;"));
if ($m['id'] and $w['id']) {
if ($m['married'] != $_POST['target1']) {
echo "<font color=red><b>Персонаж " . $_POST['target'] . " не состоит в браке с " . $_POST['target1'] . "!<b></font>";
} elseif ($w['married'] != $_POST['target']) {
echo "<font color=red><b>Персонаж " . $_POST['target1'] . " не состоит в браке с " . $_POST['target'] . "!<b></font>";
} else {
if (($user['align'] > '2' && $user['align'] < '3') || ($user['align'] > '1.6' && $user['align'] < '2')) {
if (mysql_query("UPDATE `users` SET `married`='' WHERE `id` = '{$m['id']}' LIMIT 1;") && mysql_query("UPDATE `users` SET `married`='' WHERE `id` = '{$w['id']}' LIMIT 1;")) {
$mess = "Расторжение брака между &quot;{$m['login']}&quot; и &quot;{$w['login']}&quot;, регистратор &quot;{$user['login']}&quot;.";
mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $m['id'] . "','$mess','" . time() . "');");
mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $w['id'] . "','$mess','" . time() . "');");
mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');");
echo "<font color=red><b>Успешно расторгнут брак между \"$muzh\" и \"$zhena\"!</b></font>";
} else {
echo "<font color=red><b>Произошла ошибка!<b></font>";
}
} else {
echo "<font color=red><b>Вы не можете расторгнуть брак!<b></font>";
}
}
} else {
echo "<font color=red><b>Персонаж \"$muzh\" или \"$zhena\" не существует!<b></font>";
}
?>