2018-01-28 18:40:49 +02:00
< ? php
session_start ();
if ( $_SESSION [ 'uid' ] == null ) header ( " Location: index.php " );
include " config.php " ;
$user = mysql_fetch_array ( mysql_query ( " SELECT * FROM `users` WHERE `id` = ' { $_SESSION [ 'uid' ] } ' LIMIT 1; " ));
include " functions.php " ;
if ( $user [ 'room' ] != 401 ) { header ( " Location: main.php " ); die (); }
2018-03-02 14:40:18 +02:00
if ( $user [ 'battle' ] > 0 ) { header ( 'Location: fbattle.php' ); die (); }
2018-01-28 18:40:49 +02:00
class hellround {
// проверяет участие в турнире, возвращает айди похода
function is_in_trip ( $id ) {
$f = mysql_fetch_array ( mysql_query ( " SELECT `id` FROM `hellround_pohod` WHERE `end` = 0 AND `owner`= " . $id . " LIMIT 1; " ));
return $f [ 0 ];
}
// возвращает параметры похода
function get_par ( $id ) {
return mysql_fetch_array ( mysql_query ( " SELECT * FROM `hellround_pohod` WHERE `id` = " . $id . " LIMIT 1; " ));
}
// увеличить волну
function inc_volna ( $id ) {
mysql_query ( " UPDATE `hellround_pohod` SET `volna`=`volna`+1 WHERE `id` = " . $id . " LIMIT 1; " );
}
}
$hr = new hellround ;
$mytrip = $hr -> is_in_trip ( $user [ 'id' ]);
$tr = $hr -> get_par ( $mytrip );
if ( $mytrip > 0 ) {
?>
<HTML><HEAD>
<link rel=stylesheet type="text/css" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
<META Http-Equiv=Cache-Control Content=no-cache>
<meta http-equiv=PRAGMA content=NO-CACHE>
<META Http-Equiv=Expires Content=0>
<style>
body {
background-image: url('i/hell. jpg');
background-repeat: no-repeat;
background-position: top right;
}
</style>
</HEAD>
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#e0e0e0>
<?
echo "<h3>Приближается <i>".($tr['volna']+1)."</i> волна нашествия...</h3>";
// диалоговый бот
?>
<table width=100%>
</table>
</BODY>
</HTML>
<?
}
else {
if($_GET['start'] > 0) {
$f = mysql_fetch_array(mysql_query("SELECT `date_out` FROM `hellround_pohod` WHERE `owner`= ".$user['id']." ORDER by `id` DESC LIMIT 1;"));
if((time()-strtotime($f['date_out'])) < 3600*24) {
$err = 'Сегодня вы уже ходили в поход, интервал между походами 1 сутки.';
} else {
// начиаем поход!!! за родину!!!! на черта!!! в жопу чертей!!!
mysql_query("INSERT `hellround_pohod` (`owner`) VALUES ('".$user['id']."');");
header("Location:hell.php");
}
}
?>
<HTML><HEAD>
<link rel=stylesheet type="text/css" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
<META Http-Equiv=Cache-Control Content=no-cache>
<meta http-equiv=PRAGMA content=NO-CACHE>
<META Http-Equiv=Expires Content=0>
<style>
body {
background-image: url('i/hell. jpg');
background-repeat: no-repeat;
background-position: top right;
}
</style>
</HEAD>
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#e0e0e0>
<TABLE border=0 width=100% cellspacing="0" cellpadding="0">
<td align=left>
<INPUT TYPE="button" onclick="location.href = 'hell.php?start=1';" value="НАЧАТЬ ПОХОД" name="strah">
</td>
<td align=right>
<INPUT TYPE="button" onclick="location.href = 'city.php?bps=1';" value="Вернуться" name="strah">
</table>
</form>
<FORM method=POST>
<h3>Врата Ада</h3>
<center><font color=red><B><?=$err?></B></font><BR>
<i>Отродья хаоса лезут отовсюду... Наплывы слуг хаоса не прекращаються не на минуту! Окажи посильную помощь в войне с Хаосом! Будь доблестен сердцем и душей!</i></center>
<BR>
<center>
<fieldset style="width:50%;">
<legend>
Общий ТОП
</legend>
</center>
<?
$select = mysql_query("SELECT DISTINCT `owner` FROM `hellround_pohod` ORDER by (SELECT SUM(`volna`) FROM `hellround_pohod` WHERE `owner` = `owner`) DESC LIMIT 10;");
while($f = mysql_fetch_array($select)) {
$i++;
2020-08-27 15:17:02 +03:00
echo " ".$i.". ".Nick::id($f[0])->full(1)."<BR>";
2018-01-28 18:40:49 +02:00
}
?>
<center>
</fieldset>
<fieldset style="width:50%;">
<legend>Личный ТОП</legend>
<?
$select = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `hellround_pohod` WHERE `owner` = ".$user['id'].";"));
echo "Всего походов: <B>".$select[0]."</B>.<BR>";
$select = mysql_fetch_array(mysql_query("SELECT * FROM `hellround_pohod` WHERE `owner` = ".$user['id']." ORDER by `volna` DESC LIMIT 1;"));
echo "Максимально продержался <B>".$select['volna']."</B> волн.<BR>";
$select = mysql_fetch_array(mysql_query("SELECT `date_out`,`date_in` FROM `hellround_pohod` WHERE `owner` = ".$user['id']." ORDER by `date_out`-`date_in` DESC LIMIT 1;"));
echo "Максимально продержался времени: <span class=date>".date("H:i:s",-10800+strtotime($select[0])-strtotime($select[1]))."</span>.<BR>";
?>
</fieldset>
</center>
</FORM>
</BODY>
</HTML>
<?
}
?>