31 lines
2.2 KiB
PHP
31 lines
2.2 KiB
PHP
<?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 = "Расторжение брака между "{$m['login']}" и "{$w['login']}", регистратор "{$user['login']}".";
|
||
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>";
|
||
}
|
||
?>
|