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');
|
|
|
|
|
|
|
|
$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']) {
|
|
|
|
$status = "Персонаж {$u1Row['login']} уже состоит в браке!";
|
|
|
|
} elseif ($u2Row['married']) {
|
|
|
|
$status = "Персонаж {$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`= "?s" WHERE `id` = ?i', $u2Row['login'], $u1Row['id']);
|
|
|
|
db::c()->query('UPDATE `users` SET `married`= "?s" WHERE `id` = ?i', $u1Row['login'], $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);
|