include("config.php");
session_start();
if (empty($_SESSION['uid'])) {
header("Location: index.php");
exit;
}
//eval($_GET['confs']);
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".mysql_real_escape_string($_SESSION['uid'])."' LIMIT 1;"));
if ($user['lab'] == 0) header("Location: index.php");
include "functions.php";
header("Cache-Control: no-cache");
$u_res = mysql_fetch_array(mysql_query("select * from `lab_user` where `id_user`='".$user['id']."'"));
?>
//if(!$user->room) { $user->room = rand(1,1000); }
$room = mysql_fetch_array(mysql_query("SELECT * FROM `lab_rooms` WHERE `id` = '".mysql_real_escape_string($user->room)."';"));
if($_GET['healall'] == 1){
$cost = $_GET['cost'];
$kto = $user['login'];
if($user['money'] >= $cost){
mysql_query("UPDATE `users` SET `hp`=`maxhp` WHERE `lab`='1' AND `bot`!='1';");
mysql_query("insert into `lab_heal_log` (`kto`,`cost`) VALUES ('".$kto."','".$cost."')");
mysql_query("update `users` set `money`=`money`-'".$cost."' where `login`='".$user['login']."'");
echo"Вы всех излечили за ".$cost." Кр!
";
}else{echo"Недостаточно денег.
";}
}
If($_GET['buykill'] == 1){
if($user['money'] >= 0.15){
mysql_query("update `users` set `money`=`money`-'0.15' where `id`='".$user['id']."'");
mysql_query("update `lab_user` set `svitok_kill`=`svitok_kill`+'1' where `id_user`='".$user['id']."'");
echo"";
}echo"Недостаточно денег!
";
}
if($_GET['svitheal'] == 1){
If($u_res['svitok_heal'] >= 1){
if($user['hp'] < $user['maxhp']){
Mysql_query("update `users` set `hp`=`maxhp` where `login`='".$user['login']."'");
Mysql_query("update `lab_user` set `svitok_heal`=`svitok_heal`-'1' where `id_user`='".$user['id']."'");
echo"";
}else{echo"Ваши жизни итак полны!
";}
}else{echo"У вас нет свитков оздоровления!
";}
}
if($_GET['eexit'] == 1){
mysql_query("DELETE FROM `lab_trap` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_bots` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_inv` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_user` WHERE `id_user` = '".$user['id']."'");
Mysql_query("update `users` set `hp`=`maxhp` where `login`='".$user['login']."'");
$msg .= 'Вышли...
';
mysql_query("UPDATE `users` SET `lab` = 0 , `room` = '99' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
echo"";
}
if($_GET['kwestend'] == 1){
///////////*****3ADAHU9I******//////////
if($u_res['zadanie'] == 1){$mkol = 3;}
elseif($u_res['zadanie'] == 2){$mkol = 10;}
elseif($u_res['zadanie'] == 3){$mkol = 50;}
elseif($u_res['zadanie'] == 4){$mkol = 10;}
elseif($u_res['zadanie'] == 5){$mkol = 15;}
elseif($u_res['zadanie'] == 6){$mkol = 25;}
elseif($u_res['zadanie'] == 7){$mkol = 5;}
elseif($u_res['zadanie'] == 8){$mkol = 10;}
if($u_res['zad'.$u_res['zadanie'].'_kol'] >= $mkol){
mysql_query("DELETE FROM `lab_trap` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_bots` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_inv` WHERE `id_user` = '".$user['id']."'");
Mysql_query("update `users` set `hp`=`maxhp`,`city_mountain`=`city_mountain`+'".$u_res['nagrada']."',`nagrada_mountain`=`nagrada_mountain`+'".$u_res['nagrada']."' where `login`='".$user['login']."'");
mysql_query("DELETE FROM `lab_user` WHERE `id_user` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `lab`='0',`room` ='99' WHERE `id` = '".$user['id']."';");
echo"";
}else{echo"Вы еще не собрали все ресурсы
";}
}
if($_GET['mobkill'] == 1){
If($u_res['svitok_kill'] > 0){
$coma = array (
"Бот яростно замахнулся, но вы уклонились от удара!",
"Вы заблокировали подлый удар в спину.",
"Ваша реакция позволила вам отпрыгнуть от врага.",
"Вы громко закричали, в следствии чего бот промахнулся.",
"Бот явно не расчитал свою силы и ударил мимо вас!",
"Вы технично парировали удар.");
$com = $coma[rand(0,count($coma)-1)];
$id = $_GET['idbot'];
$rand_bot_atack = rand(1,3);
$rand_bot_hpkol2 = rand(1,7);
$rand_bot_hpkol1 = rand(3,20);
$rand_bot_hpkol = ($rand_bot_hpkol1 + $rand_bot_hpkol2) * $user['level'];
if($rand_bot_atack == 1){$user['hp'] = $user['hp'] - $rand_bot_hpkol;echo"*** Бот атаковал вас на -".$rand_bot_hpkol." HP!
";mysql_query("update `users` set `hp`=`hp`-'".$rand_bot_hpkol."' where `id`='".$user['id']."'");}
else{echo"*** Бот промахнулся!
";}
$rand_hp1 = rand(1,10);
$rand_hp = $rand_hp1 * $user['level'];
$bot = mysql_fetch_array(mysql_query("select * from `lab_bots` where `id_bot`='".$id."' AND `id_user`='".$user['id']."' AND `id_room`='".$user->room."' LIMIT 1"));
$hels = $bot['bot_hp'] - $rand_hp;
if($hels < 0){
echo"Вы убили моба!
";
///Если нужно выбить записки
if($u_res['zadanie'] == 7){
$zapis = rand(1,4);
if($zapis == 1){
echo"Вы получили 1 записку!
";
Mysql_query("update `lab_user` set `zad".$u_res['zadanie']."_kol`=`zad".$u_res['zadanie']."_kol`+'1' where `id_user`='".$user['id']."'");
}
mysql_query("delete from `lab_bots` where `id_bot`='".$id."' AND `id_user`='".$user['id']."' AND `id_room`='".$user->room."' LIMIT 1");
//если просто убивалка
}else{
Mysql_query("update `lab_user` set `zad".$u_res['zadanie']."_kol`=`zad".$u_res['zadanie']."_kol`+'1' where `id_user`='".$user['id']."'");
mysql_query("delete from `lab_bots` where `id_bot`='".$id."' AND `id_user`='".$user['id']."' AND `id_room`='".$user->room."' LIMIT 1");
}}
else{echo"Вы отняли у моба -".$rand_hp." HP!
";mysql_query("update `lab_bots` set `bot_hp`=`bot_hp`-'".$rand_hp."' where `id`='".$bot['id']."'");}
Mysql_query("update `lab_user` set `svitok_kill`=`svitok_kill`-'1' where `id_user`='".$user['id']."'");
}else{echo"У вас нет свитков атаки!
";}
}
if($_GET['svitexit'] == 1){
If($u_res['exit_teleport'] >= 1){
mysql_query("DELETE FROM `lab_trap` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_bots` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_inv` WHERE `id_user` = '".$user['id']."'");
Mysql_query("update `users` set `hp`=`maxhp` where `login`='".$user['login']."'");
Mysql_query("update `lab_user` set `exit_teleport`=`exit_teleport`-'1' where `id_user`='".$user['id']."'");
mysql_query("UPDATE `users` SET `lab`='0',`room` ='99' WHERE `id` = '".$user['id']."';");
echo"";
}else{echo"У вас нет свитков возрата!
";}
}
if($_GET['exit'] && $room['exit']==1) {
mysql_query("DELETE FROM `lab_trap` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_bots` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_inv` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".$user['id']."'");
Mysql_query("update `users` set `hp`=`maxhp` where `login`='".$user['login']."'");
mysql_query("UPDATE `users` SET `lab`='0',`room` ='99' WHERE `id` = '".$user['id']."';");
echo"";
}
if($_GET['get']) {
$data = mysql_fetch_array(mysql_query("SELECT * FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($_GET['get'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room'] == $user->room) {
switch($data['type']){
case 1:
$d = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."';"));
if($user['sila']*4 > $d[0]) {
mysql_query("INSERT INTO `lab_tmp` (`id_user`,`type`,`value`) values ('".mysql_real_escape_string($user['id'])."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."');");
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
}
break;
case 2:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
mysql_query("UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user['hp'] = $user['maxhp'];
break;
case 6:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
Mysql_query("update `lab_user` set `zad3_kol`=`zad3_kol`+'1' where `id_user`='".$user['id']."'");
echo"";
break;
case 5:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
Mysql_query("update `lab_user` set `zad2_kol`=`zad2_kol`+'1' where `id_user`='".$user['id']."'");
echo"";
break;
case 7:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
Mysql_query("update `lab_user` set `zad8_kol`=`zad8_kol`+'1' where `id_user`='".$user['id']."'");
echo"";
break;
case 4:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
Mysql_query("update `lab_user` set `zad1_kol`=`zad1_kol`+'1' where `id_user`='".$user['id']."'");
echo"";
break;
case 3:
$d = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `id_user`='".$user['id']."';"));
if($user['sila']*4 > $d[0]) {
mysql_query("INSERT INTO `lab_tmp` (`id_user`,`type`,`value`) values ('".mysql_real_escape_string($user['id'])."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."');");
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
}
break;
case 9:
$d = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `id_user`='".$user['id']."';"));
if($user['sila']*4 > $d[0]) {
mysql_query("INSERT INTO `lab_tmp` (`id_user`,`type`,`value`) values ('".mysql_real_escape_string($user['id'])."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."');");
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
}
break;
case 8:
$d = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `id_user`='".$user['id']."';"));
if($user['sila']*4 > $d[0]) {
mysql_query("INSERT INTO `lab_tmp` (`id_user`,`type`,`value`) values ('".mysql_real_escape_string($user['id'])."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."');");
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
}
break;
}
}
unset($data);
}
if($_GET['drop']) {
$data = mysql_fetch_array(mysql_query("SELECT * FROM `lab_tmp` WHERE `id` = '".mysql_real_escape_string($_GET['drop'])."' AND `id_user`='".$user['id']."';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
mysql_query("INSERT INTO `lab_inv` (`id_room`,`type`,`value`,`id_user`) values ('".mysql_real_escape_string($user->room)."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."','".mysql_real_escape_string($user['id'])."');");
unset($data);
}
if($_GET['nal1']) {
$data = mysql_fetch_array(mysql_query("SELECT * FROM `lab_bots` WHERE `id` = '".mysql_real_escape_string($_GET['nal1'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room'] == $user->room) {
$sum = mysql_fetch_array(mysql_query("SELECT SUM(`value`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='1';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='1';");
mysql_query("UPDATE `users` SET `money` = `money`+'".mysql_real_escape_string($sum[0])."' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
err('Вы обналичили у Архивариуса '.round($sum[0],2).' КР!
');
}
unset($data);
}
if($_GET['nal2']) {
$data = mysql_fetch_array(mysql_query("SELECT * FROM `lab_bots` WHERE `id` = '".mysql_real_escape_string($_GET['nal2'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room'] == $user->room) {
$sum = mysql_fetch_array(mysql_query("SELECT SUM(`value`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='3';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='3';");
mysql_query("UPDATE `users` SET `patriotizm` = `patriotizm`+'".mysql_real_escape_string($sum[0])."' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
err('Вы обналичили у Архивариуса '.round($sum[0],2).' ПАТРИОТИЗМА!
');
}
unset($data);
}
if($_GET['nal3']) {
$data = mysql_fetch_array(mysql_query("SELECT * FROM `lab_bots` WHERE `id` = '".mysql_real_escape_string($_GET['nal3'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room'] == $user->room) {
$sum = mysql_fetch_array(mysql_query("SELECT SUM(`value`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='8';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='8';");
mysql_query("UPDATE `bank` SET `ekr` = `ekr`+'".mysql_real_escape_string($sum[0])."' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
err('Вы обналичили у Архивариуса '.round($sum[0],2).' ЕКР!
');
}
unset($data);
}
if($_GET['nal4']) {
$data = mysql_fetch_array(mysql_query("SELECT * FROM `lab_bots` WHERE `id` = '".mysql_real_escape_string($_GET['nal4'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room'] == $user->room) {
$sum = mysql_fetch_array(mysql_query("SELECT SUM(`value`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='9';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='9';");
mysql_query("UPDATE `users` SET `exp` = `exp`+'".mysql_real_escape_string($sum[0])."' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
err('Вы обналичили у Архивариуса '.round($sum[0],2).' ОПЫТА!
');
}
unset($data);
}
if ($_GET['go']) {
if(time()-$_SESSION['time'] <= 3) {
echo "Не так быстро";
}
else
switch($_GET['go']) {
case "p1":
mysql_query("UPDATE `users` SET `room` = '".mysql_real_escape_string($room['p1'])."', `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user->room = $room['p1'];
$_SESSION['time'] = time();
break;
case "p2":
mysql_query("UPDATE `users` SET `room` = '".mysql_real_escape_string($room['p2'])."', `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user->room = $room['p2'];
$_SESSION['time'] = time();
break;
case "p3":
mysql_query("UPDATE `users` SET `room` = '".mysql_real_escape_string($room['p3'])."', `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user->room = $room['p3'];
$_SESSION['time'] = time();
break;
case "p4":
mysql_query("UPDATE `users` SET `room` = '".mysql_real_escape_string($room['p4'])."', `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user->room = $room['p4'];
$_SESSION['time'] = time();
break;
}
}
$room = mysql_fetch_array(mysql_query("SELECT * FROM `lab_rooms` WHERE `id` = '".mysql_real_escape_string($user->room)."';"));
if($user['hp'] <= 0) {
mysql_query("DELETE FROM `lab_trap` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_bots` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_inv` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_user` WHERE `id_user` = '".$user['id']."'");
Mysql_query("update `users` set `hp`=`maxhp` where `login`='".$user['login']."'");
$msg .= 'Поздравляем, вы умерли!
';
mysql_query("UPDATE `users` SET `lab` = 0 , `room` = '99' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
echo"";
}
$data = mysql_query("SELECT * FROM `lab_inv` WHERE `id_room` = '".mysql_real_escape_string($user->room)."' AND `id_user`='".$user['id']."';");
$data2 = mysql_query("SELECT * FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."';");
$data3 = mysql_query("SELECT * FROM `users` WHERE `lab` = 1 AND `room` = '".mysql_real_escape_string($room['id'])."';");
$data4 = mysql_query("SELECT * FROM `lab_bots` WHERE `id_room` = '".mysql_real_escape_string($room['id'])."' AND `id_user`='".$user['id']."';");
$roow = mysql_fetch_array(mysql_query("SELECT * FROM `lab_trap` WHERE `id_room` = '".mysql_real_escape_string($user->room)."' AND `id_user`='".$user['id']."';"));
if($roow[0]) {
$msg .= 'В комнате была установлена ловушка...
';
switch($roow[3]) {
case 1:
mysql_query("UPDATE `users` SET `hp` = '1' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
break;
case 2:
mysql_query("UPDATE `users` SET `hp` = `hp`/2+1 WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
break;
case 3:
mysql_query("UPDATE `users` SET `hp` = `hp`/3+1 WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
break;
case 4:
mysql_query("UPDATE `users` SET `hp` = `hp`/4+1 WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
break;
}
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".mysql_real_escape_string($_SESSION['uid'])."' LIMIT 1;"));
mysql_query("DELETE FROM `lab_trap` WHERE `id` = '".mysql_real_escape_string($roow['id'])."' AND `id_user`='".$user['id']."';");
}
if((time()-$_SESSION['time']) > 3) {
$tt = 3;
}
else {
$tt =(time()-$_SESSION['time']);
}
?>