
<center><?

$db->openDB();
$location_query = mysql_query("SET NAMES cp1251");
$c_IGRVES=mysql_query("SELECT * FROM inv WHERE IL_NO=\"0\" AND ID_USERS=\"$_SESSION[s]\" AND NEVE!=\"1\"");
$igr_ves=mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$igr_ves2=mysql_fetch_assoc($igr_ves);
$loc_closed=mysql_query("SELECT * FROM location WHERE L_3ID=\"x999x001\" AND LOC_CLOSE=\"1\"");
$loc_closed2=mysql_query("SELECT * FROM location WHERE L_4ID=\"x999x002\" AND LOC_CLOSE=\"1\"");
$loc_closed3=mysql_query("SELECT * FROM location WHERE L_5ID=\"x999x003\" AND LOC_CLOSE=\"1\"");
$loc_closed4=mysql_query("SELECT * FROM location WHERE L_6ID=\"x999x004\" AND LOC_CLOSE=\"1\"");
$key_1=mysql_query("SELECT * FROM inv WHERE IL_KEY=\"i.key_1\" AND IL_NO=\"0\" AND ID_USERS=\"$_SESSION[s]\"");
if($loc=='x999x001' AND mysql_num_rows($loc_closed)>0 AND mysql_num_rows($key_1)<1){echo"<div class=\"main_title\"><font color=\"red\"><img src=\"img/bad.png\" width=\"16\" height=\"16\">комната закрыта</font></div><br/><a href=\"game.php\">в игру</a>";die;}
$key_2=mysql_query("SELECT * FROM inv WHERE IL_KEY=\"i.key_2\" AND IL_NO=\"0\" AND ID_USERS=\"$_SESSION[s]\"");
if($loc=='x999x002' AND mysql_num_rows($loc_closed2)>0 AND mysql_num_rows($key_2)<1){echo"<div class=\"main_title\"><font color=\"red\"><img src=\"img/bad.png\" width=\"16\" height=\"16\">комната закрыта</font></div><br/><a href=\"game.php\">в игру</a>";die;}
$key_3=mysql_query("SELECT * FROM inv WHERE IL_KEY=\"i.key_3\" AND IL_NO=\"0\" AND ID_USERS=\"$_SESSION[s]\"");
if($loc=='x999x003' AND mysql_num_rows($loc_closed3)>0 AND mysql_num_rows($key_3)<1){echo"<div class=\"main_title\"><font color=\"red\"><img src=\"img/bad.png\" width=\"16\" height=\"16\">комната закрыта</font></div><br/><a href=\"game.php\">в игру</a>";die;}
$key_4=mysql_query("SELECT * FROM inv WHERE IL_KEY=\"i.key_4\" AND IL_NO=\"0\" AND ID_USERS=\"$_SESSION[s]\"");
if($loc=='x999x004' AND mysql_num_rows($loc_closed4)>0 AND mysql_num_rows($key_4)<1){echo"<div class=\"main_title\"><font color=\"red\"><img src=\"img/bad.png\" width=\"16\" height=\"16\">комната закрыта</font></div><br/><a href=\"game.php\">в игру</a>";die;}

if(isset($loc) AND mysql_num_rows($c_IGRVES)>$igr_ves2[MAX_VES]){echo"<div class=\"main_title\"><font color=\"red\"><img src=\"img/bad.png\" width=\"16\" height=\"16\"> вы перегруженны движение невозможно!</font></div>";die;}

$loc_US=mysql_query("SET NAMES cp1251");
$loc_US=mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$loc_US2=mysql_fetch_assoc($loc_US);
$location_query=mysql_query("SELECT * FROM location WHERE L_IDL='$loc_US2[loc]'");
while($location=mysql_fetch_assoc($location_query))
{
$yes=$_GET['yes'];
if($loc=="x4x0" AND $query3[LVL_USERS]<8 AND !$yes==1){

echo"вы уверенны что хотите перейти в данную локацию,возможно в ней обитает очень сильный монстр!<br/>
<a href=\"game.php?loc=$loc&yes=1\">да</a>|<a href=\"game.php?NICK=$NICK&pass=$pass\">нет</a>
";die;}
if($loc_US2[LVL_USERS]<5 AND $loc=="x99x99"){echo"<div>через адресную строку не получится :-)</div>";die;}
if($loc_US2[loc]=="$location[L_IDL]"){
$np1 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_1ID]\"");
$mb1 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_1ID]\"");
$n2 = mysql_num_rows($np1);
$m2 = mysql_num_rows($mb1);
$n2m2 = $n2+$m2;
$np2 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_2ID]\"");
$mb2 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_2ID]\"");
$n3 = mysql_num_rows($np2);
$m3 = mysql_num_rows($mb2);
$n3m3 = $n3+$m3;
$np3 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_3ID]\"");
$mb3 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_3ID]\"");
$n4 = mysql_num_rows($np3);
$m4 = mysql_num_rows($mb3);
$n4m4 = $n4+$m4;
$np4 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_4ID]\"");
$mb4 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_4ID]\"");
$n5 = mysql_num_rows($np4);
$m5 = mysql_num_rows($mb4);
$n5m5 = $n5+$m5;
$np5 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_5ID]\"");
$mb5 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_5ID]\"");
$n6 = mysql_num_rows($np5);
$m6 = mysql_num_rows($mb5);
$n6m6 = $n6+$m6;
$np6 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_6ID]\"");
$mb6 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_6ID]\"");
$n7 = mysql_num_rows($np6);
$m7 = mysql_num_rows($mb6);
$n7m7 = $n7+$m7;
$np7 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_7ID]\"");
$mb7 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_7ID]\"");
$n8 = mysql_num_rows($np7);
$m8 = mysql_num_rows($mb7);
$n8m8 = $n8+$m8;
$np8 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_8ID]\"");
$mb8 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_8ID]\"");
$n9 = mysql_num_rows($np8);
$m9 = mysql_num_rows($mb8);
$n9m9 = $n9+$m9;
$np9 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_9ID]\"");
$mb9 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_9ID]\"");
$n10 = mysql_num_rows($np9);
$m10 = mysql_num_rows($mb9);
$n10m10 = $n10+$m10;
$np10 = mysql_query("SELECT * FROM npc_world WHERE npc_minHP>0 AND npc_loc=\"$location[L_10ID]\"");
$mb10 = mysql_query("SELECT * FROM mobs_world WHERE mb_MINhp>0 AND loc_mob=\"$location[L_10ID]\"");
$n11 = mysql_num_rows($np10);
$m11 = mysql_num_rows($mb10);
$n11m11 = $n11+$m11;
if(strlen($location[L_1ID])>0){echo"<li class=\"loc\"><div class=\"menu\"><a href=\"game.php?loc=$location[L_1ID]\">$location[L_1]";if($n2m2>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}
if(strlen($location[L_2ID])>0){echo"<li><div class=\"menu\"><a href=\"game.php?loc=$location[L_2ID]\">$location[L_2]";if($n3m3>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}
if(strlen($location[L_3ID])>0){echo"<li><div class=\"menu\"><a href=\"game.php?loc=$location[L_3ID]\">$location[L_3]";if($n4m4>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}
if(strlen($location[L_4ID])>0){echo"<li><div class=\"menu\"><a href=\"game.php?loc=$location[L_4ID]\">$location[L_4]";if($n5m5>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}
if(strlen($location[L_5ID])>0){echo"<li><div class=\"menu\"><a href=\"game.php?loc=$location[L_5ID]\">$location[L_5]";if($n6m6>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}
if(strlen($location[L_6ID])>0){echo"<li><div class=\"menu\"><a href=\"game.php?loc=$location[L_6ID]\">$location[L_6]";if($n7m7>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}
if(strlen($location[L_7ID])>0){echo"<li><div class=\"menu\"><a href=\"game.php?loc=$location[L_7ID]\">$location[L_7]";if($n8m8>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}
if(strlen($location[L_8ID])>0){echo"<li><div class=\"menu\"><a href=\"game.php?loc=$location[L_8ID]\">$location[L_8]";if($n9m9>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}
if(strlen($location[L_9ID])>0){echo"<li><div class=\"menu\"><a href=\"game.php?loc=$location[L_9ID]\">$location[L_9]";if($n10m10>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}
if(strlen($location[L_10ID])>0){echo"<li><div class=\"menu\"><a href=\"game.php?loc=$location[L_10ID]\">$location[L_10]";if($n11m11>0){echo" <font color=\"blue\">(звуки)</font>";}echo"</a></div></li>";}

}
if($loc=="$location[L_1ID]" AND strlen($location[L_1ID])>0 AND $loc!='' AND isset($loc))
{
?>
<?
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}

?>
<script>
location.reload(true)
</script>
 </div>
 <?
}  
if($loc=="$location[L_2ID]" AND strlen($location[L_2ID])>0 AND $loc!='' AND isset($loc))
{
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}
?>
<script>
location.reload(true)
</script>
<?
}  
if($loc=="$location[L_3ID]" AND strlen($location[L_3ID])>0 AND $loc!='' AND isset($loc))
{
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}
?>
<script>
location.reload(true)
</script>
<?
}  
if($loc=="$location[L_4ID]" AND strlen($location[L_4ID])>0 AND $loc!='' AND isset($loc))
{
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}
?>
<script>
location.reload(true)
</script>
<?
}  
if($loc=="$location[L_5ID]" AND strlen($location[L_5ID])>0 AND $loc!='' AND isset($loc))
{
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}
?>
<script>
location.reload(true)
</script>
<?
}  
if($loc=="$location[L_6ID]" AND strlen($location[L_6ID])>0 AND $loc!='' AND isset($loc))
{
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}
?>
<script>
location.reload(true)
</script>
<?
}  
if($loc=="$location[L_7ID]" AND strlen($location[L_7ID])>0 AND $loc!='' AND isset($loc))
{
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}
?>
<script>
location.reload(true)
</script>
<?
}  
if($loc=="$location[L_8ID]" AND strlen($location[L_8ID])>0 AND $loc!='' AND isset($loc))
{
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}

?>
<script>
location.reload(true)
</script>
<?
}  
if($loc=="$location[L_9ID]" AND strlen($location[L_9ID])>0 AND $loc!='' AND isset($loc))
{
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}
?>
<script>
location.reload(true)
</script>
<?
}  
if($loc=="$location[L_10ID]" AND strlen($location[L_10ID])>0 AND $loc!='' AND isset($loc))
{
if($c_items>$query3[MAX_VES]){echo"вы перегруженны движение невозможно!";die;}
$oxa = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$oxb = mysql_fetch_assoc($oxa);
$loa = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lob = mysql_fetch_assoc($loa);
if($oxb[sex] == '1'){$a="ушел";$b="пришел";}
if($oxb[sex] == '2'){$a="ушла";$b="пришла";}

$pris3 = mysql_query("SELECT * FROM users WHERE loc=\"$oxb[loc]\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris4=mysql_fetch_assoc($pris3)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris4[NICK]','$lti','$a $lob[name]')");
}
$loca_query=mysql_query("UPDATE users SET loc='$loc' WHERE NICK='$_SESSION[s]'");
$ox = mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$ox2 = mysql_fetch_assoc($ox);
$lo = mysql_query("SELECT * FROM location WHERE L_IDL=\"$loc\"");
$lo2 = mysql_fetch_assoc($lo);
if($ox2[oxr]==1 AND $lo2[OXR]==0){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы покинули охраняемую территорию','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"0\" WHERE NICK=\"$_SESSION[s]\"");
}
if($ox2[oxr]==0 AND $lo2[OXR]==1){$i=mysql_query("INSERT INTO test (prov,NICK,TIME) VALUES ('Вы на охраняемой территории','$_SESSION[s]','$lti')");
$loca_query=mysql_query("UPDATE users SET oxr=\"1\" WHERE NICK=\"$_SESSION[s]\"");
}
$pris = mysql_query("SELECT * FROM users WHERE loc=\"$loc\" AND NICK!=\"$_SESSION[s]\" AND online=\"1\"");
while($pris2=mysql_fetch_assoc($pris)){
$i=mysql_query("INSERT INTO goto (NICK,myn,TIMER,con) VALUES ('$_SESSION[s]','$pris2[NICK]','$lti','$b')");
}

?>
<script>
location.reload(true)
</script>
<?
}  
}
?>
</center>