28 lines
1.3 KiB
PHP
28 lines
1.3 KiB
PHP
<?php
|
||
if (empty($_SESSION['uid'])) {
|
||
header("Location: index.php");
|
||
exit;
|
||
}
|
||
|
||
$u1 = filter_input(INPUT_POST, 'target');
|
||
$u2 = filter_input(INPUT_POST, 'target1');
|
||
|
||
$u1Row = db::c()->query('SELECT `id`,`married`,`login` FROM `users` WHERE `login` = "?s"', $u1)->fetch_assoc();
|
||
$u2Row = db::c()->query('SELECT `id`,`married`,`login` FROM `users` WHERE `login` = "?s"', $u2)->fetch_assoc();
|
||
|
||
if ($u1Row['id'] and $u2Row['id']) {
|
||
if (($u1Row['married'] != $u2Row['login']) or ($u2Row['married'] != $u1Row['login'])) {
|
||
$status = "Персонажи {$u1Row['login']} и {$u2Row['login']} не состоят в браке друг с другом!";
|
||
} else {
|
||
if ($user['align'] > '1.6' && $user['align'] < '2') {
|
||
db::c()->query('UPDATE `users` SET `married`= 0 WHERE `id` = ?i', $u1Row['id']);
|
||
db::c()->query('UPDATE `users` SET `married`= 0 WHERE `id` = ?i', $u2Row['id']);
|
||
$status = "Расторжение брака между «{$u1Row['login']}» и «{$u2Row['login']}», регистратор «{$user['login']}».";
|
||
} else {
|
||
$status = "Вы не можете расторгнуть брак!";
|
||
}
|
||
}
|
||
} else {
|
||
$status = "Ошибка! Персонаж {$u1} или {$u2} не существует!";
|
||
}
|
||
if (!empty($status)) err($status); |