Проверки с перенаправлениями переехали в functions.php. Глобальный выход если нет сессии в config.php.

This commit is contained in:
lopar
2020-10-30 01:30:05 +02:00
parent 2024a6fac7
commit 32c72e3413
143 changed files with 6986 additions and 7329 deletions
+43 -46
View File
@@ -1,53 +1,50 @@
<?php
if(empty($_SESSION['uid'])) { header("Location: index.php"); }
$tar = mysql_fetch_array(mysql_query("SELECT `id`, `align` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['ldnick'])."' LIMIT 1"));
if (empty($_SESSION['uid'])) {
header("Location: index.php");
}
$tar = mysql_fetch_array(mysql_query("SELECT `id`, `align` FROM `users` WHERE `login` = '" . mysql_real_escape_string($_POST['ldnick']) . "' LIMIT 1"));
$target = $_POST['ldnick'];
if($tar['id']) {
$ok = 0;
$arr = array('1.1', '1.7', '1.75', '1.91', '1.98', '1.99', '2.99');
if(in_array($user['align'], $arr)) {
$ok = 1;
}
if($ok == 1) {
if($_POST['red']) {
if(!$_POST['ldtext']) {
$pal = '';
} else {
$date_today = date("m.d.y H:i");
$pal = $date_today." ".$_POST['ldtext'];
if ($tar['id']) {
$ok = 0;
$arr = ['1.1', '1.7', '1.75', '1.91', '1.98', '1.99', '2.99'];
if (in_array($user['align'], $arr)) {
$ok = 1;
}
if(mysql_query("UPDATE `users` SET `palcom` = '$pal' WHERE `id` = {$tar['id']} LIMIT 1;")) {
$mess="Сообщение от ".$user['login'].": ".$_POST['ldtext'];
mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');");
$mess="Изменена причина отправки в хаос/блокировки &quot;{$_POST['ldnick']}&quot;: $mess";
mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','".$_SESSION['uid']."','$mess','".time()."');");
echo "<font color=red><b>Успешно изменена причина отправки в хаос/блокировки персонажа \"$target\"</b></font>";
}
else {
echo "<font color=red><b>Произошла ошибка!<b></font>";
}
}
else {
$mess="Сообщение от ".$user['login'].": ".$_POST['ldtext'];
if (mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','".$tar['id']."','$mess','".time()."');")) {
$mess="Добавлена запись в дело &quot;{$_POST['ldnick']}&quot;: $mess";
mysql_query("INSERT INTO `paldelo`(`author`,`text`,`date`) VALUES ('".$_SESSION['uid']."','$mess','".time()."');");
echo "<font color=red><b>Успешно добавлена запись в дело игрока \"$target\"</b></font>";
}
else {
echo "<font color=red><b>Произошла ошибка!<b></font>";
}
}
}
else {
echo "<font color=red><b>Вы не можете добавить запись в дело этого персонажа!<b></font>";
}
}
else {
echo "<font color=red><b>Персонаж \"$target\" не существует!<b></font>";
}
if ($ok == 1) {
if ($_POST['red']) {
if (!$_POST['ldtext']) {
$pal = '';
} else {
$date_today = date("m.d.y H:i");
$pal = $date_today . " " . $_POST['ldtext'];
}
if (mysql_query("UPDATE `users` SET `palcom` = '$pal' WHERE `id` = {$tar['id']} LIMIT 1;")) {
$mess = "Сообщение от " . $user['login'] . ": " . $_POST['ldtext'];
mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');");
$mess = "Изменена причина отправки в хаос/блокировки &quot;{$_POST['ldnick']}&quot;: $mess";
mysql_query("INSERT INTO `paldelo`(`id`,`author`,`text`,`date`) VALUES ('','" . $_SESSION['uid'] . "','$mess','" . time() . "');");
echo "<font color=red><b>Успешно изменена причина отправки в хаос/блокировки персонажа \"$target\"</b></font>";
} else {
echo "<font color=red><b>Произошла ошибка!<b></font>";
}
} else {
$mess = "Сообщение от " . $user['login'] . ": " . $_POST['ldtext'];
if (mysql_query("INSERT INTO `lichka`(`id`,`pers`,`text`,`date`) VALUES ('','" . $tar['id'] . "','$mess','" . time() . "');")) {
$mess = "Добавлена запись в дело &quot;{$_POST['ldnick']}&quot;: $mess";
mysql_query("INSERT INTO `paldelo`(`author`,`text`,`date`) VALUES ('" . $_SESSION['uid'] . "','$mess','" . time() . "');");
echo "<font color=red><b>Успешно добавлена запись в дело игрока \"$target\"</b></font>";
} else {
echo "<font color=red><b>Произошла ошибка!<b></font>";
}
}
} else {
echo "<font color=red><b>Вы не можете добавить запись в дело этого персонажа!<b></font>";
}
} else {
echo "<font color=red><b>Персонаж \"$target\" не существует!<b></font>";
}