battles/magic/unmarry.php

31 lines
2.2 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?php
2018-11-01 10:40:06 +00:00
if ($_SESSION['uid'] == null) header("Location: index.php");
2018-01-28 16:40:49 +00:00
2018-11-01 10:40:06 +00:00
$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;"));
2018-01-28 16:40:49 +00:00
2018-11-01 10:40:06 +00:00
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>";
}
2018-01-28 16:40:49 +00:00
?>