Файл: b_oh_lok.php
Строк: 264
<?
define('PROTECTOR', 1);
$textl='Битва';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$bat=mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$udata['id']."'");
$bt=mysql_fetch_array($bat);
$lab=mysql_fetch_array(mysql_query("SELECT * FROM `labir` WHERE `id`='".$bt['labir']."'"));
$loka=mysql_fetch_array(mysql_query("SELECT * FROM `labir_loc_usr` WHERE `x`='".$bt['x']."' and `y`='".$bt['y']."' and `usr`='".$udata['id']."'"));
$gi=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$udata['clan']."'"));
$gus=mysql_fetch_array(mysql_query("SELECT * FROM `clan_users` WHERE `clan`='".$gi['id']."' and `usr`='".$udata['id']."'"));
$_GET['lok']=mysql_real_escape_string($_GET['lok']);
if($num_mob==0)
{
$x1=$bt['x']-1;
$x2=$bt['x'];
$x3=$bt['x']+1;
$y1=$bt['y']-1;
$y2=$bt['y'];
$y3=$bt['y']+1;
if($_GET['lok']==1){
$loks1=mysql_query("SELECT * FROM `labir_loc_usr` WHERE `x`='".$x2."' and `y`='".$y1."' and `usr`='".$udata['id']."'");
$n_l1=mysql_num_rows($loks1);if($n_l1!=0){
$lk1=mysql_fetch_array($loks1);
mysql_query("UPDATE `labir_usr` SET `x`='".$lk1['x']."', `y`='".$lk1['y']."' WHERE `id`='".$bt['id']."'");
if($gus['kv_s']==0 and $gus['kv_s_n']<5 and $bt['labir']==1 and $udata['clan']!=0)
{
$rand=rand(1,3);
if($rand==1)
{
$nd=$gus['kv_s_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: найдено ".$nd." детей.</font>'
");
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($gus['kv_s']==3 and $gus['kv_s_n']<20 and $bt['labir']==3 and $udata['clan']!=0)
{
$rand=rand(1,3);
if($rand==1)
{
$nd=$gus['kv_s_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: найдено ".$nd." солдат.</font>'
");
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($lab['id']==1 and $udata['kv_d']==21)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 25</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
if($lab['id']==2 and $udata['kv_d']==23)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 30</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
if($lab['id']==3 and $udata['kv_d']==29)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 30</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
}
}
elseif($_GET['lok']==2){
$loks1=mysql_query("SELECT * FROM `labir_loc_usr` WHERE `x`='".$x2."' and `y`='".$y3."' and `usr`='".$udata['id']."'");
$n_l1=mysql_num_rows($loks1);if($n_l1!=0){
$lk1=mysql_fetch_array($loks1);
mysql_query("UPDATE `labir_usr` SET `x`='".$lk1['x']."', `y`='".$lk1['y']."' WHERE `id`='".$bt['id']."'");
if($gus['kv_s']==0 and $gus['kv_s_n']<5 and $bt['labir']==1 and $udata['clan']!=0)
{
$rand=rand(1,3);
if($rand==1)
{
$nd=$gus['kv_s_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: найдено ".$nd." детей.</font>'
");
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($gus['kv_s']==3 and $gus['kv_s_n']<20 and $bt['labir']==3 and $udata['clan']!=0)
{
$rand=rand(1,3);
if($rand==1)
{
$nd=$gus['kv_s_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: найдено ".$nd." солдат.</font>'
");
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($lab['id']==1 and $udata['kv_d']==21)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 25</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
if($lab['id']==2 and $udata['kv_d']==23)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 30</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
if($lab['id']==3 and $udata['kv_d']==29)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 30</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
}
}
elseif($_GET['lok']==3){
$loks1=mysql_query("SELECT * FROM `labir_loc_usr` WHERE `x`='".$x1."' and `y`='".$y2."' and `usr`='".$udata['id']."'");
$n_l1=mysql_num_rows($loks1);if($n_l1!=0){
$lk1=mysql_fetch_array($loks1);
mysql_query("UPDATE `labir_usr` SET `x`='".$lk1['x']."', `y`='".$lk1['y']."' WHERE `id`='".$bt['id']."'");
if($gus['kv_s']==0 and $gus['kv_s_n']<5 and $bt['labir']==1 and $udata['clan']!=0)
{
$rand=rand(1,3);
if($rand==1)
{
$nd=$gus['kv_s_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: найдено ".$nd." детей.</font>'
");
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($gus['kv_s']==3 and $gus['kv_s_n']<20 and $bt['labir']==3 and $udata['clan']!=0)
{
$rand=rand(1,3);
if($rand==1)
{
$nd=$gus['kv_s_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: найдено ".$nd." солдат.</font>'
");
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($lab['id']==1 and $udata['kv_d']==21)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 25</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
if($lab['id']==2 and $udata['kv_d']==23)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 30</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
if($lab['id']==3 and $udata['kv_d']==29)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 30</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
}
}
elseif($_GET['lok']==4){
$loks1=mysql_query("SELECT * FROM `labir_loc_usr` WHERE `x`='".$x3."' and `y`='".$y2."' and `usr`='".$udata['id']."'");
$n_l1=mysql_num_rows($loks1);if($n_l1!=0){
$lk1=mysql_fetch_array($loks1);
mysql_query("UPDATE `labir_usr` SET `x`='".$lk1['x']."', `y`='".$lk1['y']."' WHERE `id`='".$bt['id']."'");
if($gus['kv_s']==0 and $gus['kv_s_n']<5 and $bt['labir']==1 and $udata['clan']!=0)
{
$rand=rand(1,3);
if($rand==1)
{
$nd=$gus['kv_s_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: найдено ".$nd." детей.</font>'
");
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($gus['kv_s']==3 and $gus['kv_s_n']<20 and $bt['labir']==3 and $udata['clan']!=0)
{
$rand=rand(1,3);
if($rand==1)
{
$nd=$gus['kv_s_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: найдено ".$nd." солдат.</font>'
");
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($lab['id']==1 and $udata['kv_d']==21)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 25</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
if($lab['id']==2 and $udata['kv_d']==23)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 30</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
if($lab['id']==3 and $udata['kv_d']==29)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 30</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
}
}
}
header('location: b_oh.php');exit;
?>