Файл: clans.php
Строк: 183
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$textl='Гильдии';
include($path.'files/core.php');
$giz=mysql_num_rows(mysql_query("SELECT * FROM `clan` WHERE `id`='".$_GET['id']."'"));
if($giz==0)
{
header('location: game.php');exit;
}
$gi=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$_GET['id']."'"));
if(isset($_GET['m1']))
{
if($udata['admin']==6)
{
$aq=mysql_query("SELECT * FROM `users` WHERE `clan`='".$gi['id']."'");
while($us=mysql_fetch_array($aq))
{
$j=$us['jem']+15;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$us['id']."'");
$rows21=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$us['id']."' and `usr2`='0'"));
if($rows21==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$us['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$us['id']."'");
}
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
$text='Ваша Гильдия заняла первое место в рейтинге Гильдий! За это вы получаете <img src=img/main/p13.png>15.';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows2['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$us['id']."'
");
}
$wood=$gi['wood']+500;
$steel=$gi['steel']+500;
$energy=$gi['energy']+1000;
mysql_query("UPDATE `clan` SET `reit`='0', `wood`='".$wood."', `steel`='".$steel."', `energy`='".$energy."' WHERE `id`='".$gi['id']."'");
$text='1. <a href=clans.php?id='.$gi['id'].'>'.$gi['name'].'</a> +<img src=img/main/p13.png>15';
mysql_query("UPDATE `aaa` SET `day`='".$dsas."', `text`='".$text."' WHERE `id`='5'");
header('location: reit.php?r=gi');exit;
}
}
if(isset($_GET['m2']))
{
if($udata['admin']==6)
{
$aq=mysql_query("SELECT * FROM `users` WHERE `clan`='".$gi['id']."'");
while($us=mysql_fetch_array($aq))
{
$j=$us['jem']+10;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$us['id']."'");
$rows21=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$us['id']."' and `usr2`='0'"));
if($rows21==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$us['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$us['id']."'");
}
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
$text='Ваша Гильдия заняла второе место в рейтинге Гильдий! За это вы получаете <img src=img/main/p13.png>10.';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows2['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$us['id']."'
");
}
$wood=$gi['wood']+350;
$steel=$gi['steel']+350;
$energy=$gi['energy']+700;
mysql_query("UPDATE `clan` SET `reit`='0', `wood`='".$wood."', `steel`='".$steel."', `energy`='".$energy."' WHERE `id`='".$gi['id']."'");
$dbz=mysql_query("SELECT * FROM `aaa` WHERE `id`='5'");
$dbzv=mysql_fetch_array($dbz);
$text=$dbzv['text'].'<br>2. <a href=clans.php?id='.$gi['id'].'>'.$gi['name'].'</a> +<img src=img/main/p13.png>10';
mysql_query("UPDATE `aaa` SET `day`='".$dsas."', `text`='".$text."' WHERE `id`='5'");
header('location: reit.php?r=gi');exit;
}
}
if(isset($_GET['m3']))
{
if($udata['admin']==6)
{
$aq=mysql_query("SELECT * FROM `users` WHERE `clan`='".$gi['id']."'");
while($us=mysql_fetch_array($aq))
{
$j=$us['jem']+5;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$us['id']."'");
$rows21=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$us['id']."' and `usr2`='0'"));
if($rows21==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$us['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$us['id']."'");
}
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
$text='Ваша Гильдия заняла третье место в рейтинге Гильдий! За это вы получаете <img src=img/main/p13.png>5.';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows2['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$us['id']."'
");
}
$wood=$gi['wood']+200;
$steel=$gi['steel']+200;
$energy=$gi['energy']+400;
mysql_query("UPDATE `clan` SET `reit`='0', `wood`='".$wood."', `steel`='".$steel."', `energy`='".$energy."' WHERE `id`='".$gi['id']."'");
$dbz=mysql_query("SELECT * FROM `aaa` WHERE `id`='5'");
$dbzv=mysql_fetch_array($dbz);
$text=$dbzv['text'].'<br>3. <a href=clans.php?id='.$gi['id'].'>'.$gi['name'].'</a> +<img src=img/main/p13.png>5';
mysql_query("UPDATE `aaa` SET `day`='".$dsas."', `text`='".$text."' WHERE `id`='5'");
header('location: reit.php?r=gi');exit;
}
}
if(isset($_GET['m4']))
{
if($udata['admin']==6)
{
mysql_query("UPDATE `clan` SET `reit`='0'");
header('location: reit.php?r=gi');exit;
}
}
$sostav=mysql_fetch_array(mysql_query("SELECT * FROM `clan_bild` WHERE `clan`='".$gi['id']."' and `img`='6'"));
$ms=5+$sostav['lvl']*3;
$ys=mysql_num_rows(mysql_query("SELECT * FROM `clan_users` WHERE `clan`='".$gi['id']."'"));
if(isset($_GET['zaf']))
{
if($udata['lvl']<20 or $udata['clan']!=0 or $ys==$ms and $udata['clan_close']>time())
{
}
else
{
$num=mysql_num_rows(mysql_query("SELECT * FROM `clan_za` WHERE `usr`='".$udata['id']."' and `clan`='".$gi['id']."'"));
if($num!=0){
}
else
{
mysql_query("INSERT INTO `clan_za` SET `id`='', `usr`='".$udata['id']."', `clan`='".$gi['id']."'");
}
}
header('location: clans.php?id='.$gi['id'].'');exit;
}
if(isset($_GET['def']))
{
$num=mysql_num_rows(mysql_query("SELECT * FROM `clan_za` WHERE `usr`='".$udata['id']."' and `clan`='".$gi['id']."'"));
if($num!=0){
mysql_query("DELETE FROM `clan_za` WHERE `usr`='".$udata['id']."' and `clan`='".$gi['id']."'");
}
header('location: clans.php?id='.$gi['id'].'');exit;
}
include($path.'files/head.php');
include($path.'files/zag.php');
echo '<table width=100%>
<tr>
<td width=35%>
<a href=game.php><div style="background: #882222; border-radius: 7px 0 0 7px" class="m p bts bbs brs bls" align=center>Главная</div></a>
</td><td>';
echo '<a href=?><div class="line bts brs bls bbs p m" style="border-radius: 0 7px 7px 0">
<font color=#ffffff>
<font color=#ffff00>'.$gi['name'].'</font> <img src=img/main/p10.png>'.$gi['lvl'].'
</font>
</div></a></td></tr></table>';
echo '<div class="bat bts brs bls bbs p">';
$lider=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$gi['lider']."'"));
echo '<img src=img/main/e30.png> Глава: ';
echo '<img src=img/main/c'.$lider['klass'].'.png> <img src=img/main/r'.$lider['rasa'].'.png> ';
echo '<a href=info.php?id='.$lider['id'].'>'.$lider['usr'].'</a> <img src=img/main/p10.png>'.$lider['lvl'].'<br>';
echo '<img src=img/main/e30.png> Состав: '.$ys.' из '.$ms.'<br>';
echo '<img src=img/main/e30.png> Рейтинг: <img src=img/main/cl1.png>'.$gi['reit'].'<br><br>';
echo '<table width=100%>
<tr class="v3 p">
<td align=center>Имя</td>
<td align=center>Ур.</td>
</tr>';
$sost=mysql_query("SELECT * FROM `clan_users` WHERE `clan`='".$gi['id']."' ORDER BY `reit` ASC");
while($st=mysql_fetch_array($sost))
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$st['usr']."'"));
echo '<tr>';
echo '<td align=center>';
echo '<img src=img/main/c'.$us['klass'].'.png> <img src=img/main/r'.$us['rasa'].'.png> ';
echo '<a href=info.php?id='.$us['id'].'>'.$us['usr'].'</a>';
echo'</td>';
echo '<td align=center>'.$us['lvl'].'</td>';
echo '</tr>';
}
echo '</table>';
if($udata['clan_close']<time())
{
$num=mysql_num_rows(mysql_query("SELECT * FROM `clan_za` WHERE `usr`='".$udata['id']."' and `clan`='".$gi['id']."'"));
if($num==0){
echo '<a href=?zaf&id='.$gi['id'].'><div style="background: #662222; padding: 1px; margin: 4px; border-radius: 6px" align=center>
<font color=#ffff00>Подать Заявку</font></div></a>
';
}
else
{
echo '<a href=?def&id='.$gi['id'].'><div style="background: #666622; padding: 1px; margin: 4px; border-radius: 6px" align=center>
<font color=#ffff00>Отменить Заявку</font></div></a>
';
}
}
if($udata['admin']==6)
{
echo '<div class="box p m"> <a href=?m1&id='.$gi['id'].'>1 место</a> | <a href=?m2&id='.$gi['id'].'>2 место</a>
| <a href=?m3&id='.$gi['id'].'>3 место</a> | <a href=?m4&id='.$gi['id'].'>обнул</a>
</div>';
}
echo '</div>';
include('files/down.php');
?>