battles/magic/unmarry.php

25 lines
1.3 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?php
2018-11-01 11:19:07 +00:00
if (empty($_SESSION['uid'])) header("Location: index.php");
2018-01-28 16:40:49 +00:00
2018-11-01 11:19:07 +00:00
$u1 = filter_input(INPUT_POST, 'target');
$u2 = filter_input(INPUT_POST, 'target1');
2018-01-28 16:40:49 +00:00
2018-11-01 11:19:07 +00:00
$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']} не состоят в браке друг с другом!";
2018-11-01 10:40:06 +00:00
} else {
2018-11-01 11:19:07 +00:00
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']}».";
2018-11-01 10:40:06 +00:00
} else {
2018-11-01 11:19:07 +00:00
$status = "Вы не можете расторгнуть брак!";
2018-11-01 10:40:06 +00:00
}
}
} else {
2018-11-01 11:19:07 +00:00
$status = "Ошибка! Персонаж {$u1} или {$u2} не существует!";
2018-11-01 10:40:06 +00:00
}
2018-11-01 11:19:07 +00:00
if (!empty($status)) err($status);