Файл: _gladiators2_/gladiators2/gladiators/gladiators/map.php
Строк: 342
<?
@session_start(); // Начало сессии
if(!$_SESSION["id"]) {
echo"<script language=Javascript>top.window.location='/index.php';</script>";
exit();
}
@include("connect.php");
@include("includes/redir.php");
@include("includes/std.h.php");
@include("includes/usrinf.h.php");
@include("system/config/servers.php");
@include("system/config/values.php");
@include("system/class/main_class.php");
@include("system/includes/gzip.php");
$inf = new UserDate;
$db = new DBconn;
$db->Conn("greece",$server_conf);
if($_GET["fight"])
{
sleep(3);
$_GET["fight"] = htmlspecialchars($_GET["fight"]);
$inf2 = new UserDate; // Добавляем информацию о жертве
$inf->get_info("id;locate;level;hp;maxhp;battle_id;align;klan;",$_SESSION["id"]);
if($inf2->get_info("id;login;level;battle_id;locate;level;hp;maxhp;align;klan;",$_GET["fight"])==false)
$error_msg = "Персонаж не существует";
elseif($inf2->id==$_SESSION["id"])
$error_msg = "На себя нельзя напасть!";
elseif(check_online($inf2->login,"2",$config["rooms"])==0 && !($inf2->battle_id && $inf2->locate=="0"))
$error_msg = "Персонаж не в этом районе";
elseif($inf->level < 10 || $inf2->level < 10)
$error_msg = "Возможность доступна только для персонажей с 10-го уровня";
elseif(( ($inf->hp*100) / $inf->maxhp) < 33)
$error_msg = "Вы слишком слабы, чтобы учавствовать в поединке";
elseif(( ($inf2->hp*100) / $inf2->maxhp) < 33 && !$inf2->battle_id)
$error_msg = "Ваш соперник слишком слаб, чтобы учавствовать в поединке";
elseif(!$inf2->battle_id && !$inf->battle_id) {
@mysql_query("insert into battle(start,timeout,side1,side2,kick_time,hp,data,type,battle,hall) values('".time()."','900','".$_SESSION[id].";','".$inf2->id.";','".$_SESSION[id]."=".time().";".$inf2->id."=".time().";','".$_SESSION[id]."=0;".$inf2->id."=0;','".$_SESSION["id"]."#".$_SESSION["login"]."#".$inf->level."#".$inf->klan."#".$inf->align.";".$inf2->id."#".$inf2->login."#".$inf2->level."#".$inf2->klan."#".$inf2->align.";','group','arm','street')");
$battle_id = mysql_insert_id();
@mysql_query("update users set battle_id='".$battle_id."' where (id=".$_SESSION["id"]." or id='".$inf2->id."') and battle_id='0'");
@mysql_query("insert into battle_logs(battle_id,cmt_id,time,type,ch1,ch2) values('".$battle_id."','5','".time()."','greating','".$_SESSION["id"]."','".$inf2->id."')");
Header("Location: map.php?pl=0");
}
elseif(!$inf->battle_id)
{
@mysql_query("LOCK TABLES battle WRITE");
$res_batt = @mysql_query("select start,side1,side2,winner,type,kick_time,hp,data,hall from battle where id=".$inf2->battle_id);
$row_batt = @mysql_fetch_array($res_batt);
if( $row_batt["type"]!="group" || $row_batt["hall"]!="street" )
$error_msg = "Поединок проходит не в загородном районе.";
elseif( $row_batt["winner"]!="" )
$error_msg = "Поединок соперника завершен!";
else {
if( preg_match("/(^|;)(".$inf2->id.";)/",$row_batt["side1"]) )
$my_side = "side2";
else
$my_side = "side1";
$new_side = $row_batt[$my_side].$_SESSION["id"].";";
$new_kick = $row_batt["kick_time"].$_SESSION["id"]."=".time().";";
$new_hp = $row_batt["hp"].$_SESSION["id"]."=0;";
$new_data = $row_batt["data"].$_SESSION["id"]."#".$_SESSION["login"]."#".$inf->level."#".$inf->klan."#".$inf->align.";";
$res = @mysql_query("update battle set ".$my_side."='".$new_side."', kick_time='".$new_kick."', hp='".$new_hp."',data='".$new_data."' where id='".$inf2->battle_id."' and ('".$my_side."' NOT LIKE '%;".$_SESSION["id"].";%' and '".$my_side."' NOT LIKE '".$_SESSION["id"].";%')");
@mysql_query("UNLOCK TABLES");
if($res) {
@mysql_query("update users set battle_id=".$inf2->battle_id." where id='".$_SESSION[id]."' and battle_id='0'");
@mysql_query("insert into battle_logs(battle_id,cmt_id,time,type,ch1) values('".$inf2->battle_id."','3','".time()."','greating','".$_SESSION["id"]."')");
@Header("Location: battle.php");
exit();
}
}
}
}
$row_users = @mysql_fetch_array(mysql_query("select locate from users where id=".$_SESSION[id]));
switch($_GET[pl])
{
default:
if(preg_match("/^[0-4]$/",$row_users["locate"]))
@Header("Location: map.php?pl=".$row_users["locate"]);
else
@Header("Location: ".$row_users["locate"].".php");
exit();
break;
case"0":
if(!preg_match("/^(0|1|2|3|4|coliseum|shop|tavern)$/",$row_users["locate"]))
{
if(preg_match("/^[0-4]$/",$row_users["locate"]))
@Header("Location: map.php?pl=".$row_users["locate"]);
else
@Header("Location: ".$row_users["locate"].".php");
exit();
}
break;
case"1":
if(!preg_match("/^(0|1|bank|telegraf|church|senate_build)$/",$row_users["locate"]))
{
if(preg_match("/^[0-3]$/",$row_users["locate"]))
@Header("Location: map.php?pl=".$row_users["locate"]);
else
@Header("Location: ".$row_users["locate"].".php");
exit();
}
break;
case"2":
if(!preg_match("/^(0|2|building)$/",$row_users["locate"]))
{
if(preg_match("/^[0-3]$/",$row_users["locate"]))
@Header("Location: map.php?pl=".$row_users["locate"]);
else
@Header("Location: ".$row_users["locate"].".php");
exit();
}
break;
case"3":
if(!preg_match("/^(0|3|house)$/",$row_users["locate"]))
{
if(preg_match("/^[0-3]$/",$row_users["locate"]))
@Header("Location: map.php?pl=".$row_users["locate"]);
else
@Header("Location: ".$row_users["locate"].".php");
exit();
}
break;
case"4":
if(!preg_match("/^(0|4|market)$/",$row_users["locate"]))
{
if(preg_match("/^[0-4]$/",$row_users["locate"]))
@Header("Location: map.php?pl=".$row_users["locate"]);
else
@Header("Location: ".$row_users["locate"].".php");
exit();
}
break;
}
if(!preg_match("/^[0-9]+$/",$_GET["pl"]))
$_GET["pl"] = "0";
@mysql_query("update users set locate='".$_GET["pl"]."' where id=".$_SESSION["id"]);
if($_SESSION["room"]!=$_GET["pl"])
{
session_register('room');
$room = $_GET["pl"];
echo"<script language=javascript>
top.frames['online'].window.location = 'online.php';
</script>";
}
?>
<html>
<head>
<link rel=stylesheet href=/css/index.css>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
<META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
<meta http-equiv=PRAGMA content=NO-CACHE>
<META Http-Equiv=Expires Content=0>
<script language=javascript>
if(window.history.forward(1) != null)
window.history.forward(1);
function re()
{
window.location.href = window.location.href;
}
var ChatDelay = 600; // Через сколько секунд обновить
setTimeout("re();", ChatDelay*1000);
var mess;
</script>
</head>
<body bgcolor=#e5e1be>
<br>
<center>
<table border=0 width=90% cellspacing=0 cellpadding=2>
<tr>
<td width=100%>
<span style='color:#000000;font-weight:bold' id=inr></span>
<span id=imges></span>
</td>
<td>
<?
$navigate[0][0] = "Главная улица";
$navigate[0][1] = "На этой улице находятся: Колизей, где проводятся великие сражения, государственная лавка в которой вы можете купить для себя: оружие, доспехи, различные мелочи.<br>Вскоре вы сможете отдохнуть, восстанавливая здоровье, в таверне.";
$navigate[0][2] = "4,Рыночная площадь";
$navigate[0][3] = "2,Загородный район";
$navigate[0][4] = "1,Столичный район";
$navigate[0][5] = "3,Жилой район";
$navigate[0][6] = "Колизей:coliseum;Лавка:shop;Таверна:tavern";
$navigate[1][0] = "Столичный район";
$navigate[1][1] = "Здесь вы можете открыть себе счёт в банке, отправить сообщение кому-либо в телеграфе, а также обратиться за помощью к Сенаторам.";
$navigate[1][2] = "";
$navigate[1][3] = "";
$navigate[1][4] = "";
$navigate[1][5] = "0,Главная улица";
$navigate[1][6] = "Здание Сената:senate_build;Банк:bank;Телеграф:telegraf;Церковь:church";
$navigate[2][0] = "Загородный район";
$navigate[2][1] = "Забытое богом место, здесь собираются самые сильные гладиаторы и поджидают своих жертв, что бы напасть. Также здесь функционирует строительная организация, которая берет на работу желающих подзаработать.";
$navigate[2][2] = "0,Главная улица";
$navigate[2][3] = "";
$navigate[2][4] = "";
$navigate[2][5] = "";
$navigate[2][6] = "Стройка:building";
$navigate[3][0] = "Жилой район";
$navigate[3][1] = "Это район где расположен ваш дом и дома других греков, где вы родились и с тех пор продолжаете свой путь воина...";
$navigate[3][2] = "";
$navigate[3][3] = "";
$navigate[3][4] = "0,Главная улица";
$navigate[3][5] = "";
$navigate[3][6] = "Дом:house";
$navigate[4][0] = "Рыночная площадь";
$navigate[4][1] = "Торговый район города, здесь вы сможете поторговаться за покупки необходимых вещей или продать свои вещи за выгодные деньги, а может и наоборот!";
$navigate[4][2] = "";
$navigate[4][3] = "0,Главная улица";
$navigate[4][4] = "";
$navigate[4][5] = "";
$navigate[4][6] = "Рынок:market";
echo"<span style='color:darkred;font-weight:bold'>".$error_msg."</span>";
echo"<table border=0 cellspacing=0 cellpadding=2 width=146><tr><td></td><td align=center>";
if($navigate[$_GET["pl"]][4] != "")
{
$krd = explode(",",$navigate[$_GET["pl"]][4]);
echo"<a style='cursor:hand' onclick="top.perehod('map.php?pl=".$krd[0]."','".$krd[1]."')"><img src=img/map-up.gif border=0 alt='".$krd[1]."'></a>";
}
echo"</td><td></td></tr><tr><td width=18>";
if($navigate[$_GET["pl"]][2] != "")
{
$krd = explode(",",$navigate[$_GET["pl"]][2]);
echo"<a style='cursor:hand' onclick="top.perehod('map.php?pl=".$krd[0]."','".$krd[1]."')"><img width=18 height=16 src=img/map-left.gif border=0 alt='".$krd[1]."'></a>";
}
echo"</td><td align=center width=110><input type=button style='font-size:11px;font-weight:bold;' class=button value='".$navigate[$_GET["pl"]][0]."' onclick='window.location=window.location.href'></td><td width=18>";
if($navigate[$_GET["pl"]][3] != "")
{
$krd = explode(",",$navigate[$_GET["pl"]][3]);
echo"<a style='cursor:hand' onclick="top.perehod('map.php?pl=".$krd[0]."','".$krd[1]."')"><img width=18 height=16 src=img/map-right.gif border=0 alt='".$krd[1]."'></a>";
}
echo"</td></tr><tr><td></td><td align=center>";
if($navigate[$_GET["pl"]][5] != "")
{
$krd = explode(",",$navigate[$_GET["pl"]][5]);
echo"<a style='cursor:hand' onclick="top.perehod('map.php?pl=".$krd[0]."','".$krd[1]."')"><img width=18 height=16 src=img/map-down.gif border=0 alt='".$krd[1]."'></a>";
}
echo"</td><td></td></tr></table>
</td></tr></table>
</td></tr></table>
<br>
<table border=0 width=90% cellspacing=0 cellpadding=2>
<tr><td width=100% valign=top>
<b>".$navigate[$_GET["pl"]][0]."</b><br><br>".$navigate[$_GET["pl"]][1]."<hr size=2 color=#392F10 align=left>
</td></tr>
<tr><td>
<center>
<table border=0 cellspacing=1 cellpadding=0 bgcolor=#000000><tr>";
$ways = explode(";",$navigate[$_GET["pl"]][6]);
for($i=0;$i<=count($ways)-1;$i++)
{
$row = explode(":",$ways[$i]);
if(($i+1) % 5 == 0)
echo"</tr><tr>n";
echo"<td bgcolor=#e7e7db><a ";
if(file_exists($row[1].".php"))
echo"href=#".$row[1]." onclick="top.perehod('".$row[1].".php','".$row[0]."');" title='Переместиться в "".$row[0].""'";
else
echo"title='Вход закрыт'";
echo"><img src=/img/b_".$row[1].".gif border=0 height=23></a></td>";
}
echo"
</tr>
</table>
</center>";
if($_GET["pl"]=="2")
{
echo"<br>
<span id=contextmenu style='position:absolute;z-index:100' ></span>
<script language=javascript>
function attack(text)
{
document.all('contextmenu').innerHTML = text;
document.all('contextmenu').style.visibility = 'visible';
document.all('contextmenu').style.left = screen.width/2-240;
document.all('contextmenu').style.top = screen.height/2-200;
document.all('fight').focus();
}
function attackclose()
{
document.all('contextmenu').style.visibility='hidden';
}
</script>";
?>
<input type=button value='напасть' class=button style='font-weight:bold' onclick='attack("<table border=0 cellspacing=2 cellpadding=9 bgcolor=#3a3a3a width=350 height=50 onblur="attackclose()" ><form action=map.php method=get><input type=hidden name=pl value=2><tr><td bgcolor=#cbcbb0><table border=0 cellspacing=0 cellpadding=0><tr><td><center><span ><b>Нападение на улице</b></center></td></tr><tr><td class=comm>Ник жертвы:</span> <input type=text name=fight size=30> <input type=submit class=button value=`Напасть` style=`font-weight:bold`></td></tr><tr><td class=comm style="font-size:60%">Эта функция доступна только для персонажей c 10-го уровня.</td></tr></form></table></td></tr></table>");' >
<?
}
$count_online = 0;
$rooms = explode(";",$config["rooms"]);
for($i=0;$i<=count($rooms)-2;$i++)
{
$row = explode(",",$rooms[$i]);
if($row[0]!="private")
$count_online += count(file("chat/date/".$row[0]."/online.dat"));
}
$db->query("select count(*) from users where world='Greece'");
$db->fetch_array();
$count_reg = $db->row[0];
echo"<br><br>
<table border=0 cellspacing=0 cellpadding=0>
<tr><td class=comm><b>Население страны:</b></td></tr>
<tr><td class=comm>прописаны: ".NumberView($count_reg,",")." чел.</td></tr>
<tr><td class=comm>онлайн: ".NumberView($count_online,",")." чел.</td></tr>
</table>
<br>
</body>
</html>";
?>