Проверки с перенаправлениями переехали в 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

View File

@@ -1,65 +1,56 @@
<?php
session_start();
if (!($_SESSION['uid'] > 0)) header("Location: index.php");
if ($user->battle) { header('location: fbattle.php'); exit; }
include "../config.php";
if($_GET['act']=="atk"){
$ass = mysql_query("SELECT glav_id,glava,name FROM labirint WHERE user_id=".$user['id']."");
$lab = mysql_fetch_array($ass);
$glav_id = $lab["glav_id"];
$asx = mysql_query("SELECT login FROM labirint WHERE glav_id='$glav_id' and boi='".$_GET['n']."'");
if(!$lax = mysql_fetch_array($asx)){
$f = mysql_query("SELECT `n".$_GET['n']."` FROM podzem3 WHERE glava='".$lab["glava"]."' and name='".$lab["name"]."'");
$rt = mysql_fetch_array($f);
startpod($user['login'],$rt['n'.$_GET['n'].''],$_GET['n'],$user);
}else{
$jert = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `login` = '".$lax["login"]."' LIMIT 1;"));
if($jert['id']!=$user['id']) {
$bet=1;
//арх
if($jert['id'] > _BOTSEPARATOR_) {
$arha = mysql_fetch_array(mysql_query ('SELECT * FROM `bots` WHERE `prototype` = '.$jert['id'].' LIMIT 1;'));
$jert['battle'] = $arha['battle'];
$jert['id'] = $arha['id'];
$bot=1;
}
if($jert['battle'] > 0) {
//вмешиваемся
$bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$jert['battle'].' LIMIT 1;'));
$battle = unserialize($bd['teams']);
$battle[$user['id']] = $battle[$jert['id']];
foreach($battle[$user['id']] as $k => $v) {
$battle[$k][$user['id']] = array(0,0,time());
}
$t1 = explode(";",$bd['t1']);
// проставляем кто-где
if (in_array ($jert['id'],$t1)) {
$ttt = 1;
} else {
$ttt = 2;
}
//addch ("<b>".nick7($user['id'])."</b> вмешался в <a href=logs.php?log=".$id." target=_blank>поединок »»</a>. ",$user->room);
session_start();
require_once "functions.php";
if ($_GET['act'] == "atk") {
$ass = mysql_query("SELECT glav_id,glava,name FROM labirint WHERE user_id=" . $user['id'] . "");
$lab = mysql_fetch_array($ass);
$glav_id = $lab["glav_id"];
$asx = mysql_query("SELECT login FROM labirint WHERE glav_id='$glav_id' and boi='" . $_GET['n'] . "'");
if (!$lax = mysql_fetch_array($asx)) {
$f = mysql_query("SELECT `n" . $_GET['n'] . "` FROM podzem3 WHERE glava='" . $lab["glava"] . "' and name='" . $lab["name"] . "'");
$rt = mysql_fetch_array($f);
startpod($user['login'], $rt['n' . $_GET['n'] . ''], $_GET['n'], $user);
addlog($jert['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' вмешался в поединок1!<BR>');
} else {
mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'`=CONCAT(`t'.$ttt.'`,\';'.$user['id'].'\') WHERE `id` = '.$jert['battle'].' ;');
$jert = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `login` = '" . $lax["login"] . "' LIMIT 1;"));
if ($jert['id'] != $user['id']) {
mysql_query("UPDATE users SET `battle` =".$jert['battle'].",`zayavka`=0 WHERE `id`= ".$user['id']);
mysql_query("UPDATE `labirint` SET `boi`='".$_GET['n']."',`di`='0' WHERE `user_id`='".$user['id']."'");
$bet = 1;
//арх
if ($jert['id'] > _BOTSEPARATOR_) {
$arha = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `prototype` = ' . $jert['id'] . ' LIMIT 1;'));
$jert['battle'] = $arha['battle'];
$jert['id'] = $arha['id'];
$bot = 1;
}
if ($jert['battle'] > 0) {
//вмешиваемся
$bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $jert['battle'] . ' LIMIT 1;'));
$battle = unserialize($bd['teams']);
$battle[$user['id']] = $battle[$jert['id']];
foreach ($battle[$user['id']] as $k => $v) {
$battle[$k][$user['id']] = [0, 0, time()];
}
$t1 = explode(";", $bd['t1']);
}}}
// проставляем кто-где
if (in_array($jert['id'], $t1)) {
$ttt = 1;
} else {
$ttt = 2;
}
addlog($jert['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' вмешался в поединок1!<BR>');
mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '`=CONCAT(`t' . $ttt . '`,\';' . $user['id'] . '\') WHERE `id` = ' . $jert['battle'] . ' ;');
mysql_query("UPDATE users SET `battle` =" . $jert['battle'] . ",`zayavka`=0 WHERE `id`= " . $user['id']);
mysql_query("UPDATE `labirint` SET `boi`='" . $_GET['n'] . "',`di`='0' WHERE `user_id`='" . $user['id'] . "'");
}
}
}
print "<script>location.href=\"main.php?act=none\";</script>";
exit;
print "<script>location.href=\"main.php?act=none\";</script>";
exit;
}

View File

@@ -1,51 +1,51 @@
<?php
session_start();
if (!($_SESSION['uid'] > 0)) header("Location: index.php");
include "../config.php";
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
if ($user['login']=="testik2" || $user['login']=="-apollon-") {
session_start();
require_once "../config.php";
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
if ($user['admin']) {
?>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
<table width="700" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="300" align="left" valign="top">
<?
$nec = mysql_query("SELECT * FROM podzem2");
while ($sc = mysql_fetch_array($nec)) {
print"<a href='edit_podzem.php?name=" . $sc['name'] . "'>" . $sc['name'] . "</a><br />";
?>
<table width="100%" border="1" cellspacing="0" cellpadding="0"><tr>
<td align="left" valign="top">
<table width="700" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="300" align="left" valign="top">
<?
$nec = mysql_query("SELECT * FROM podzem2");
while($sc = mysql_fetch_array($nec)){
print"<a href='edit_podzem.php?name=".$sc['name']."'>".$sc['name']."</a><br />";
}
?>
}
?>
</td>
<td width="400" align="left" valign="top">
<form action="" method="get">
<? if(!$_GET['new']){ ?>
<input name="new" type="submit" value="Создать новую" />
<?
if($_GET['new']){
print "<script>location.href='main.php?act=none'</script>";
exit;}
if($_GET['news']){
$SQL2 = mysql_query("INSERT INTO podzem2(name) VALUES('".$_GET['name']."')");
print "<script>location.href='edit.php'</script>";
exit;}
</td>
<td width="400" align="left" valign="top">
}else{ ?>
<input style="font-size:12px;" name="name" type="text" size="10" value="Название" />
<input name="news" type="submit" value="Создать" />
<?
} ?>
<form action="" method="get">
<? if (!$_GET['new']) { ?>
<input name="new" type="submit" value="Создать новую"/>
<?
if ($_GET['new']) {
print "<script>location.href='main.php?act=none'</script>";
exit;
}
if ($_GET['news']) {
$SQL2 = mysql_query("INSERT INTO podzem2(name) VALUES('" . $_GET['name'] . "')");
print "<script>location.href='edit.php'</script>";
exit;
}
</td>
</tr>
</table>
</td>
</tr></table>
<?
} else { ?>
<input style="font-size:12px;" name="name" type="text" size="10" value="Название"/>
<input name="news" type="submit" value="Создать"/>
<?
} ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
}
?>

View File

@@ -3,7 +3,7 @@
if ($user->battle) { header('location: fbattle.php'); exit; }
include "../config.php";
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
if ($user['login']=="testik2" || $user['login']=="-apollon-" ) {
if ($user['admin']) {
?>
<table width="100%" border="1" cellspacing="0" cellpadding="0"><tr>