$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'])."'");
//mysql_query("DELETE FROM `inventory` WHERE name='Бутерброд' and owner='".$varsa['id']."' and podzem='1'");
$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','Лука')");
$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','Лука')");
$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','Лука')");
$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','Лука')");
$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','Лука')");
$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','Лука')");
$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','Лука')");
if($stloc=='13.1'){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','Лука')");
if($stloc=='14.1'){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','Лука')");
$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','Подземка')");
//Удаляем ключик с локи
//mysql_query("UPDATE `podzem4` SET n".$_GET['n']." = '' WHERE glava='".$glava."' and name='".$mir['name']."'");
$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','Лука')");
if($stloc=='12.1'){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','Лука')");
$fer=mysql_query("SELECT n".mysql_escape_string($rhar[$mesto][$_GET['path']])." FROM podzem3 WHERE glava='".$mir['glava']."' and name='".$mir['name']."'");
<tdalign="center"><Ahref="#"onClick="findlogin( 'Выберите персонажа которого хотите выгнать','canalizaciya.php', 'kill')"><IMGalt="Выгнать из группы"src="i/labirint3/ico_kill_member1.gif"></A> <Ahref="#"onClick="findlogin( 'Выберите персонажа которому хотите передать лидерство','canalizaciya.php', 'change')"><IMGalt="Передать лидерство"src="i/labirint3/ico_change_leader1.gif"></A></td>