$rost=mysql_fetch_array(mysql_query("SELECT `user_id` FROM `labirint` WHERE `glava`='{$glava}' and `login`='".mysql_escape_string($_GET['kill'])."'"));
$varsa=mysql_fetch_array(mysql_query("SELECT id FROM `users` WHERE `login` = '".mysql_escape_string($_GET['kill'])."' LIMIT 1;"));
if($varsaand$rost){
if($_GET['kill']!=$glava){
mysql_query("DELETE FROM labirint WHERE login='".mysql_escape_string($_GET['kill'])."'");
$rost=mysql_fetch_array(mysql_query("SELECT `user_id` FROM `labirint` WHERE `glava`='$glava' and `login`='".mysql_escape_string($_GET['change'])."'"));
$varsa=mysql_fetch_array(mysql_query("SELECT id FROM `users` WHERE `login` = '".mysql_escape_string($_GET['change'])."' LIMIT 1;"));
if($varsaand$rost){
if($_GET['change']!=$glava){
mysql_query("UPDATE labirint SET glav_id='".$varsa['id']."',glava='".$_GET['change']."' WHERE glava='".$user['login']."'");
mysql_query("UPDATE podzem3 SET glava='".$_GET['change']."' WHERE glava='".$user['login']."'");
$ferrr=mysql_query("SELECT n$mesto FROM `podzem3` WHERE glava='$glava' and name='".$mir['name']."'");
$retr=mysql_fetch_array($ferrr);
$stloc=$retr["n$mesto"];
if($stloc=='508'or$stloc=='507'or$stloc=='506'){
if($stloc=='508'){
mysql_query("UPDATE `podzem3` SET n$mesto='507' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='507'){
mysql_query("UPDATE `podzem3` SET n$mesto='506' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='506'){
mysql_query("UPDATE `podzem3` SET n$mesto='' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Чистая гайка'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1,massa=massa+0.1 WHERE owner='".$user['id']."' and `type`='200' and `name`='Чистая гайка'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Чистая гайка','1','g_c.gif','".$user['id']."','200','0.1','0','Лука')");
}
$mis="Чистая гайка";
podzem_brat();
print" <span class='success'>Вы получили 'Чистая гайка'</span>";
}else{
if($stloc==''){
print" <span class='error'>Кто-то оказался быстрее!</span>";
$ferrr=mysql_query("SELECT n$mesto FROM `podzem3` WHERE glava='$glava' and name='".$mir['name']."'");
$retr=mysql_fetch_array($ferrr);
$stloc=$retr["n$mesto"];
if($stloc=='503'or$stloc=='502'or$stloc=='501'){
if($stloc=='503'){
mysql_query("UPDATE `podzem3` SET n$mesto='502' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='502'){
mysql_query("UPDATE `podzem3` SET n$mesto='501' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='501'){
mysql_query("UPDATE `podzem3` SET n$mesto='' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Гайка'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1, massa=massa+0.1 WHERE owner='".$user['id']."' and `type`='200' and `name`='Гайка'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Гайка','1','g.gif','".$user['id']."','200','0.1','0','Лука')");
}
$mis="Гайка";
podzem_brat();
print" <span class='success'>Вы получили 'Гайка'</span>";
}else{
if($stloc==''){
print" <span class='error'>Кто-то оказался быстрее!</span>";
$ferrr=mysql_query("SELECT n$mesto FROM `podzem3` WHERE glava='$glava' and name='".$mir['name']."'");
$retr=mysql_fetch_array($ferrr);
$stloc=$retr["n$mesto"];
if($stloc=='504'or$stloc=='505'or$stloc=='506'){
if($stloc=='506'){
mysql_query("UPDATE `podzem3` SET n$mesto='505' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='505'){
mysql_query("UPDATE `podzem3` SET n$mesto='504' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='504'){
mysql_query("UPDATE `podzem3` SET n$mesto='' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Вентиль'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1,massa=massa+0.2 WHERE owner='".$user['id']."' and `type`='200' and `name`='Вентиль'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Вентиль','1','v.gif','".$user['id']."','200','0.2','0','Лука')");
}
$mis="Вентиль";
podzem_brat();
print" <span class='success'>Вы получили 'Вентиль'</span>";
}else{
if($stloc==''){
print" <span class='error'>Кто-то оказался быстрее!</span>";
$ferrr=mysql_query("SELECT n$mesto FROM `podzem3` WHERE glava='$glava' and name='".$mir['name']."'");
$retr=mysql_fetch_array($ferrr);
$stloc=$retr["n$mesto"];
if($stloc=='512'or$stloc=='513'or$stloc=='514'){
if($stloc=='514'){
mysql_query("UPDATE `podzem3` SET n$mesto='513' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='513'){
mysql_query("UPDATE `podzem3` SET n$mesto='512' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='512'){
mysql_query("UPDATE `podzem3` SET n$mesto='' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Чистый вентиль'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1,massa=massa+0.4 WHERE owner='".$user['id']."' and `type`='200' and `name`='Чистый вентиль'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Чистый вентиль','1','v2.gif','".$user['id']."','200','0.4','0','Лука')");
}
$mis="Чистый вентиль";
podzem_brat();
print" <span class='success'>Вы получили 'Чистый вентиль'</span>";
}else{
if($stloc==''){
print" <span class='error'>Кто-то оказался быстрее!</span>";
$ferrr=mysql_query("SELECT n$mesto FROM `podzem3` WHERE glava='$glava' and name='".$mir['name']."'");
$retr=mysql_fetch_array($ferrr);
$stloc=$retr["n$mesto"];
if($stloc=='507'or$stloc=='508'or$stloc=='509'){
if($stloc=='509'){
mysql_query("UPDATE `podzem3` SET n$mesto='508' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='508'){
mysql_query("UPDATE `podzem3` SET n$mesto='507' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='507'){
mysql_query("UPDATE `podzem3` SET n$mesto='' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Болт'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1,massa=massa+0.1 WHERE owner='".$user['id']."' and `type`='200' and `name`='Болт'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Болт','1','bolt.gif','".$user['id']."','200','0.1','0','Лука')");
}
$mis="Болт";
podzem_brat();
print" <span class='success'>Вы получили 'Болт'</span>";
}else{
if($stloc==''){
print" <span class='error'>Кто-то оказался быстрее!</span>";
$ferrr=mysql_query("SELECT n$mesto FROM `podzem3` WHERE glava='$glava' and name='".$mir['name']."'");
$retr=mysql_fetch_array($ferrr);
$stloc=$retr["n$mesto"];
if($stloc=='511'or$stloc=='510'or$stloc=='509'){
if($stloc=='511'){
mysql_query("UPDATE `podzem3` SET n$mesto='510' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='510'){
mysql_query("UPDATE `podzem3` SET n$mesto='509' WHERE glava='$glava' and name='".$mir['name']."'");
}
if($stloc=='509'){
mysql_query("UPDATE `podzem3` SET n$mesto='' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Длинный болт'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1,massa=massa+0.2 WHERE owner='".$user['id']."' and `type`='200' and `name`='Длинный болт'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Длинный болт','1','dbolt.gif','".$user['id']."','200','0.2','0','Лука')");
}
$mis="Длинный болт";
podzem_brat();
print" <span class='success'>Вы получили 'Длинный болт'</span>";
}else{
if($stloc==''){
print" <span class='error'>Кто-то оказался быстрее!</span>";
$ferrr=mysql_query("SELECT n$mesto FROM `podzem3` WHERE glava='$glava' and name='".$mir['name']."'");
$retr=mysql_fetch_array($ferrr);
$stloc=$retr["n$mesto"];
if($stloc=='510'){
if($stloc=='510'){
mysql_query("UPDATE `podzem3` SET n$mesto='' WHERE glava='$glava' and name='".$mir['name']."'");
}
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Ключиик','1','kluchik.gif','".$user['id']."','200','0.5','0','Лука')");
$mis="Ключиик";
podzem_brat();
print" <span class='success'>Вы получили 'Ключиик'</span>";
}else{
if($stloc==''){
print" <span class='error'>Кто-то оказался быстрее!</span>";
mysql_query("UPDATE `podzem4` SET n".$_GET['n']."='13.0' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Гайка'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1,massa=massa+0.1 WHERE owner='".$user['id']."' and `type`='200' and `name`='Гайка'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Гайка','1','g.gif','".$user['id']."','200','0.1','0','Лука')");
}
$mis="Гайка";
podzem_brat();
print" <span class='success'>Вы получили 'Гайка'</span>";
}
}else{
if($stloc=='13.0'){
print" <span class='error'>Кто-то оказался быстрее!</span>";
mysql_query("UPDATE `podzem4` SET n".$_GET['n']."='14.0' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Болт'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1,massa=massa+0.1 WHERE owner='".$user['id']."' and `type`='200' and `name`='Болт'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Болт','1','bolt.gif','".$user['id']."','200','0.1','0','Лука')");
}
$mis="Болт";
podzem_brat();
print" <span class='success'>Вы получили 'Болт'</span>";
}
}else{
if($stloc=='14.0'){
print" <span class='error'>Кто-то оказался быстрее!</span>";
$ferrr=mysql_query("SELECT n".$_GET['n']." FROM `podzem4` WHERE glava='$glava' and name='".$mir['name']."'");
$retr=mysql_fetch_array($ferrr);
$stloc=$retr["n".$_GET['n'].""];
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Ключик №".mysql_escape_string($_GET['b'])."'");
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Ключик №".mysql_escape_string($_GET['b'])."','1','$stloc.gif','".$user['id']."','200','0.1','0','Подземка')");
$ferrr=mysql_query("SELECT n".$_GET['n']." FROM `podzem4` WHERE glava='$glava' and name='".$mir['name']."'");
$retr=mysql_fetch_array($ferrr);
$stloc=$retr["n".$_GET['n'].""];
$shans=rand(0,100);
if($shans<51){
mysql_query("UPDATE `podzem4` SET n".$_GET['n']."='11.0' WHERE glava='$glava' and name='".$mir['name']."'");
$stloc='11.0';
}
if($stloc=='11.1'){
if($mesto==$_GET['n']){
if($stloc=='11.1'){
mysql_query("UPDATE `podzem4` SET n".mysql_escape_string($_GET['n'])."='11.0' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Гайка'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1,massa=massa+0.1 WHERE owner='".$user['id']."' and `type`='200' and `name`='Гайка'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Гайка','1','g.gif','".$user['id']."','200','0.1','0','Лука')");
}
$mis="Гайка";
podzem_brat();
print" <span class='success'>Вы получили 'Гайка'</span>";
mysql_query("UPDATE `podzem4` SET n".mysql_escape_string($_GET['n'])."='12.0' WHERE glava='$glava' and name='".$mir['name']."'");
}
$f=mysql_query("SELECT `maxdur` FROM `inventory` WHERE `owner`='".$user['id']."' and `type`='200' and `name`='Гайка'");
if($g=mysql_fetch_array($f)){
$koll=$g["maxdur"];
mysql_query("UPDATE `inventory` SET maxdur=maxdur+1,massa=massa+0.1 WHERE owner='".$user['id']."' and `type`='200' and `name`='Гайка'");
}else{
$fo=mysql_query("INSERT INTO `inventory`(name,maxdur,img,owner,type,massa,isrep,present) VALUES('Гайка','1','g.gif','".$user['id']."','200','0.1','0','Лука')");
}
$mis="Гайка";
podzem_brat();
print" <span class='success'>Вы получили 'Гайка'</span>";
$fer=mysql_query("SELECT n".mysql_escape_string($rhar[$mesto][$_GET['path']])." FROM podzem3 WHERE glava='".$mir['glava']."' and name='".$mir['name']."'");