battles/magic/unmarry.php
2018-01-28 18:40:49 +02:00

47 lines
2.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// magic идентификацыя
//if (rand(1,2)==1) {
if ($_SESSION['uid'] == null) header("Location: index.php");
$m = mysql_fetch_array(mysql_query("SELECT `id`,`align`,`married`,`sex`,`login` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
$w = mysql_fetch_array(mysql_query("SELECT `id`,`align`,`married`,`sex`,`login` FROM `users` WHERE `login` = '{$_POST['target1']}' LIMIT 1;"));
$muzh=$_POST['target'];
$zhena=$_POST['target1'];
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>";
}
elseif ($m['sex'] != 1) {
echo "<font color=red><b>Неправильный пол жениха!<b></font>";
}
elseif ($w['sex'] != 0) {
echo "<font color=red><b>Неправильный пол невесты!<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;$muzh&quot; и &quot;$zhena&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>";
}
?>