battles/top.php

338 lines
15 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?php
header('Location: rating_users.php');
die();
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;"));
include "functions.php";
?>
<HTML><HEAD><TITLE>Браузерная онлайн игра capitalcity.old-dark.ru</TITLE>
<META content=INDEX,FOLLOW name=robots>
<META content="1 days" name=revisit-after>
<META http-equiv=Content-type content="text/html; charset=utf-8">
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Cache-control content=private>
<META http-equiv=Expires content=0><LINK href="css/main.css" type=text/css rel=stylesheet>
<style>
.pleft {
PADDING-RIGHT: 0px; PADDING-LEFT: 20px; PADDING-BOTTOM: 7px; MARGIN: 0px; PADDING-TOP: 3px
}
</style>
</HEAD>
<BODY bgColor=#3D3D3B leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td scope="col"><table width="100%" height="135" border="0" cellpadding="0" cellspacing="0">
<tr>
<td scope="col"><div align="center"></div></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" height="100%" valign="top"><table width="75%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td scope="col"><table cellspacing=0 cellpadding=0 width="100%" bgcolor=#f2e5b1
border=0>
<tbody>
<tr>
<td height="1" colspan=3 bgcolor="#F2E5B1">
<p></p>
<td width="30" rowspan=2 align="right" valign=top>
<p><BR>
<BR>
</p>
<DIV align=right>
<TABLE height="90%" cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top></TD>
</TR>
</TBODY>
</TABLE>
</DIV></td>
<td width="23" rowspan=2 align="right" height=100% valign=top >
</td>
</tr>
<tr>
<td width="29" valign=top ></td>
<td valign=top width="30"></td>
<td valign=top><!-- Begin of text -->
<h3><br>
</h3>
<TABLE width="100%" border=0 cellPadding=2 cellSpacing=0 name="F1">
<TBODY>
<TR>
<TD colSpan=3><H3><p style="COLOR: #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 12pt; FONT-WEIGHT: bold; TEXT-ALIGN: center">ТОП 25 лучших игроков Бойцовского Клуба</p></center>
<span class="style5"><table border=0 cellpadding=3 align=center>
<tr bgcolor=cdc9c9>
<td width=100><b>Место</b></td>
<td width=300><b>Логин</b></td>
<td width=100><b>Опыт</b></td>
</tr>
<?
$tech=array("1241","1242","1243","1244","1990","1253","1254","1255","1256","1257");
$data = mysql_query("SELECT * FROM `users` WHERE `block`='0' AND `align`<>'4' ORDER by `exp` DESC;");
while($row = mysql_fetch_array($data)) {
if(!in_array($row['id'],$tech) && $user['align']!=4 && $user['block']!=1)
{
$n+=1;
echo "<TR><td style='color:8f0000;'>( ".$n." )<TD style='color:8f0000;'>",$row['login'],"[".$row['level']."]<a href=inf.php?".$row['id']." target=_blank><IMG SRC=i/inf.gif WIDTH=12 HEIGHT=11 border=0 ALT=\"Инф. о ".$row['login']."\"></a><TD>[",$row['exp'],"]<TD>";
echo "</TR>";
if ($n==25) break;
}
}
//рейтинг рефералов
?>
</TBODY></TABLE><br>
<TABLE width="100%" border=0 cellPadding=2 cellSpacing=0 name="F1">
<TBODY>
<TR>
<TD colSpan=3><H3><p style="COLOR: #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 12pt; FONT-WEIGHT: bold; TEXT-ALIGN: center">ТОП 10 рефералов за неделю</p></center>
<span class="style5"><table border=0 cellpadding=3 align=center>
<tr bgcolor=cdc9c9>
<td width=100><b>Место</b></td>
<td width=300><b>Логин</b></td>
<td width=100><b>Прибыль</b></td>
</tr>
<?
$ref_out=array();
$var_w=mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE var='ref_week' LIMIT 1;"));
$var_m=mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE var='ref_month' LIMIT 1;"));
$var_w_id=mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE var='ref_w_id' LIMIT 1;"));
$var_m_id=mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE var='ref_m_id' LIMIT 1;"));
$tech=array("1241","1242","1243","1244","1990","1253","1254","1255","1256","1257");
$n=0;
$tm=time();
$data = mysql_query("SELECT id,login FROM `users` WHERE align<>'4' AND block=0;");
$date_lim=$var_w['value'];
while($row = mysql_fetch_array($data))
{
$ref_money=mysql_fetch_array(mysql_query("SELECT SUM(money) FROM `referal` WHERE master_id='{$row['id']}' AND date>'{$date_lim}' LIMIT 1;"));
if(!in_array($row['id'],$tech) && $ref_money[0])
{
$ref_w_out[$row['login']]=$ref_money[0];
}
}
arsort($ref_w_out);
//рефералы недели
foreach($ref_w_out as $log=>$mon)
{
$n+=1;
$wr=mysql_fetch_array(mysql_query("SELECT id FROM `users` WHERE login='{$log}' LIMIT 1;"));
if($var_w_id['value']==0 && $n==1)
{
if($var_w_id['value']==0 && date("N",$tm)=="6")
{
mysql_query("UPDATE variables SET value='{$wr['id']}' WHERE var='ref_w_id';");
$dress=mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE id='273' LIMIT 1;"));
mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,
`gsila`,`glovk`,`ginta`,`gintel`,`ghp`,`gnoj`,`gtopor`,`gdubina`,
`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,
`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,
`nnoj`,`ntopor`,`ndubina`,`nmech`,`nfire`,`nwater`,`nair`,`nearth`,
`nlight`,`ngray`,`ndark`,`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,
`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,
`nalign`,`dategoden`,`goden`,`otdel`,`gmp`,`gmeshok`,`encicl`,
`artefact`,`duration`)
VALUES
('{$dress['id']}','{$mr_id['id']}','{$dress['name']}','{$dress['type']}',
{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},
{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}',
'{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}',
'{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}',
'{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}',
'{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}',
'{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}',
'{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}',
'{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}',
'{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}','{$dress['mfkrit']}',
'{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}',
'{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}',
'{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}',
'{$dress['nalign']}','".(3*24*60*60+time())."','3','{$dress['razdel']}',
'{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','{$dur}');");
addchp ('Как реферал недели, Вы получили '.$dress['name'].'!','{[]}'.nick7 ($v).'{[]}');
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`)
VALUES ('','0','{$user['id']}','\"".$log['login']."\" получил как реферал недели ".$dress['name']."',1,'".time()."');");
}
}
echo "<TR><td style='color:8f0000;'>( ".$n." )<TD style='color:8f0000;'>",$log,"<TD style='color:8f0000;'>",$mon;
echo "</TR>";
if ($n==10) break;
}
$n=0;
?>
</TBODY></TABLE><br>
<TABLE width="100%" border=0 cellPadding=2 cellSpacing=0 name="F1">
<TBODY>
<TR>
<TD colSpan=3><H3><p style="COLOR: #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 12pt; FONT-WEIGHT: bold; TEXT-ALIGN: center">ТОП 10 рефералов за месяц</p></center>
<span class="style5"><table border=0 cellpadding=3 align=center>
<tr bgcolor=cdc9c9>
<td width=100><b>Место</b></td>
<td width=300><b>Логин</b></td>
<td width=100><b>Прибыль</b></td>
</tr>
<?php
//рефералы месяца
$date_lim=$var_m['value'];
$data = mysql_query("SELECT id,login FROM `users` WHERE align<>'4' AND block=0;");
while($row = mysql_fetch_array($data))
{
$ref_money=mysql_fetch_array(mysql_query("SELECT SUM(money) FROM `referal` WHERE master_id='{$row['id']}' AND date>'{$date_lim}' LIMIT 1;"));
if(!in_array($row['id'],$tech) && $ref_money[0])
{
$ref_m_out[$row['login']]=$ref_money[0];
}
}
arsort($ref_m_out);
foreach($ref_m_out as $log=>$mon)
{
$n+=1;
$mr=mysql_fetch_array(mysql_query("SELECT id FROM `users` WHERE login='{$log}' LIMIT 1;"));
if($var_m_id['value']==0 && $n==1)
{
if($var_m_id['value']==0 && date("t",$tm)==date("d",$tm))
{
mysql_query("UPDATE variables SET value='{$mr['id']}' WHERE var='ref_m_id';");
$dress=mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE id='273' LIMIT 1;"));
mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,
`gsila`,`glovk`,`ginta`,`gintel`,`ghp`,`gnoj`,`gtopor`,`gdubina`,
`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,
`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,
`nnoj`,`ntopor`,`ndubina`,`nmech`,`nfire`,`nwater`,`nair`,`nearth`,
`nlight`,`ngray`,`ndark`,`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,
`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,
`nalign`,`dategoden`,`goden`,`otdel`,`gmp`,`gmeshok`,`encicl`,
`artefact`,`duration`)
VALUES
('{$dress['id']}','{$mr_id['id']}','{$dress['name']}','{$dress['type']}',
{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},
{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}',
'{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}',
'{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}',
'{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}',
'{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}',
'{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}',
'{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}',
'{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}',
'{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}','{$dress['mfkrit']}',
'{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}',
'{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}',
'{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}',
'{$dress['nalign']}','".(3*24*60*60+time())."','3','{$dress['razdel']}',
'{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','{$dur}');");
addchp ('Как реферал месяца, Вы получили '.$dress['name'].'!','{[]}'.nick7 ($v).'{[]}');
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`)
VALUES ('','0','{$user['id']}','\"".$log['login']."\" получил как реферал месяца ".$dress['name']."',1,'".time()."');");
$_POST['digger']=0;
}
}
echo "<TR><td style='color:8f0000;'>( ".$n." )<TD style='color:8f0000;'>",$log,"<TD style='color:8f0000;'>",$mon;
echo "</TR>";
if ($n==10) break;
}
$n=0;
?>
</TBODY></TABLE><br>
<TABLE width="100%" border=0 cellPadding=2 cellSpacing=0 name="F1">
<TBODY>
<TR>
<TD colSpan=3><H3><p style="COLOR: #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 12pt; FONT-WEIGHT: bold; TEXT-ALIGN: center">ТОП 10 рефералов Бойцовского Квартала</p></center>
<span class="style5"><table border=0 cellpadding=3 align=center>
<tr bgcolor=cdc9c9>
<td width=100><b>Место</b></td>
<td width=300><b>Логин</b></td>
<td width=100><b>Прибыль</b></td>
</tr>
<?php
//полный список рефералов
$data = mysql_query("SELECT id,login FROM `users` WHERE align<>'4' AND block=0;");
while($row = mysql_fetch_array($data))
{
$ref_money=mysql_fetch_array(mysql_query("SELECT SUM(money) FROM `referal` WHERE master_id='{$row['id']}' LIMIT 1;"));
if(!in_array($row['id'],$tech) && $ref_money[0])
{
$ref_out[$row['login']]=$ref_money[0];
}
}
arsort($ref_out);
foreach($ref_out as $log=>$mon)
{
$n+=1;
$mr_id=mysql_fetch_array(mysql_query("SELECT id FROM `users` WHERE login='{$log}' LIMIT 1;"));
echo "<TR><td style='color:8f0000;'>( ".$n." )<TD style='color:8f0000;'>",$log,"<TD style='color:8f0000;'>",$mon;
echo "</TR>";
if ($n==10) break;
}
//}
?>
</TBODY></TABLE><br>
<?
$num = mysql_num_rows(mysql_query("SELECT `id` FROM `users` WHERE `block`='0' AND `align`<>'4';"));
echo"Всего жителей: <b>".$num."</b>";
?>
</td></tr>
</TD>
</TR>
</FORM>
</TABLE>
</TBODY></tr>
</table></td>
</tr>
</table>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width="100%" height=13 ></TD>
</TR>
<TR>
<TD width="100%"
height=20><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="10%" align="center" scope="col">
<div align="left">
</tr>
</table></TD>
</TR>
</TBODY>
</TABLE>
</BODY></HTML>