diff --git a/c_haos.php b/c_haos.php index 73e236e..c777745 100644 --- a/c_haos.php +++ b/c_haos.php @@ -1,281 +1,270 @@ room != 600) { + header("Location: main.php"); + exit; +} +if ($user->battle) { + header('location: fbattle.php'); + exit; +} + +$in_haos = mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_status` WHERE `id` = '{$user['id']}';")); +$owntravma = mysql_fetch_array(mysql_query("SELECT * FROM `effects` WHERE `owner` = " . $user['id'] . " AND (type=13 OR type=12 OR type=14) limit 1;")); +$wait_msg = "Ждем подтверждения от всей группы..."; + +function getPass($length = 6) +{ + $chars = 'abcdefghijklmnopqrstyvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789'; + $numChars = strlen($chars); + $string = ''; + for ($i = 0; $i < $length; $i++) { $string .= substr($chars, rand(1, $numChars) - 1, 1); - } - return $string; } - - if(!$in_haos) - { - mysql_query("INSERT INTO cit_haos_status(id) values('{$user['id']}');"); - $in_haos=mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_status` WHERE `id` = '{$user['id']}' LIMIT 1;")); - } - include "functions.php"; - $pass_s=getPass(6); - if ($user->room != 600) { header("Location: main.php"); exit; } - if ($user->battle) { header('location: fbattle.php'); exit; } - if ($_POST['pay']) - { - if(!$_POST['pay_gr']) $_POST['pay_gr']=1; - $group_num=mysql_num_rows(mysql_query("SELECT * FROM `cit_haos_status` WHERE `group` = '{$_POST['pay_gr']}';")); - $cit_haos_pl=mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_var` WHERE `group`='".$_POST['pay_gr']."' LIMIT 1;")); - $gps=$_POST['gr_pass_in'.$_POST['pay_gr']]; - if($gps) - $gps=str_replace(" ","",$gps); - - if($group_num<4) - if($user['hp']>=(int)($user['maxhp']/3) && !$owntravma[0]) - if($user['money']>=20) - if( - !preg_match('/[\/\:*?"<>|+%]/',$gps)&& - ( - ($gps==$cit_haos_pl['password'] && strlen($cit_haos_pl['password'])>1)|| - (strlen($cit_haos_pl['players'])<3) - ) - ) - - { - - mysql_query("UPDATE `cit_haos_status` SET `status` = '1',`group` = '{$_POST['pay_gr']}' WHERE `id` ='{$user['id']}'; "); - mysql_query("UPDATE `users` set `money` = `money`- '20' WHERE id = '{$user['id']}';"); - $cit_haos_gr=mysql_num_rows(mysql_query("SELECT * FROM `cit_haos_var`;")); - - if($_POST['pay_gr']>$cit_haos_gr) - mysql_query("INSERT INTO `cit_haos_var`(`group`,`password`) values('".$_POST['pay_gr']."','".$pass_s."');"); - $cit_haos_pl=mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_var` WHERE `group`='".$_POST['pay_gr']."' LIMIT 1;")); - if(!in_array($user['id'],explode(";",$cit_haos_pl['players']))) - { - - if($cit_haos_pl['players']!='') - $ch_pl_t=$cit_haos_pl['players'].";".$user['id']; - else - $ch_pl_t=$user['id']; - mysql_query("UPDATE `cit_haos_var` SET `players`='{$ch_pl_t}' WHERE `group`='".$_POST['pay_gr']."';"); - } - } - else ($pass_in_err="Неверный пароль!"); - - else ($pay_err="Недостаточно денег для подачи стартового взноса!"); - else ($pay_err="Вы слишком ослаблены либо травмированы! "); - else ($pay_err="Группа уже набрана!"); - } - if ($_POST['adm_start_raid'] && $user['id']==1256) - { - mysql_query("DELETE FROM `cit_haos_status`;"); - mysql_query("DELETE FROM `cit_haos_var`;"); - AddChatSystem('Начинается прием заявок в рейд на Цитадель Хаоса! Начало рейда через 15 минут.'); - $ch_time=time(); - mysql_query("UPDATE variables SET value='{$ch_time}' where var='cit_haos_time';"); - } - if ($_POST['test_start_raid'] && $user['id']==1256) - { - mysql_query("DELETE FROM `cit_haos_status`;"); - mysql_query("DELETE FROM `cit_haos_var`;"); - // AddChatSystem('Начинается прием заявок в рейд на Цитадель Хаоса! Начало рейда через 15 минут.'); - $ch_time=time(); - mysql_query("UPDATE variables SET value='{$ch_time}' where var='cit_haos_time';"); - } - if ($in_haos['room'] != 0 && $in_haos['status'] == 2) - { - mysql_query("UPDATE `users`,`online` SET `users`.`room` = '601',`online`.`room` = '601' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;"); - header('location: c_haos_in.php'); - - } - if ($in_haos['status'] == 2) - { - $group_num=mysql_num_rows(mysql_query("SELECT * FROM `cit_haos_status` WHERE `group` = '{$in_haos['group']}';")); - $group_ready=mysql_num_rows(mysql_query("SELECT * FROM `cit_haos_status` WHERE (`status` = '2' AND `group` = '{$in_haos['group']}');")); - if($group_num==$group_ready && $group_ready>0) - { - mysql_query("UPDATE `users`,`online` SET `users`.`room` = '601',`online`.`room` = '601' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;"); - mysql_query("UPDATE `cit_haos_status` SET room='1' WHERE id = '{$user['id']}'; "); - header('location: c_haos_in.php'); - } - } -$in_haos = mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_status` WHERE `id` = '{$user['id']}' LIMIT 1;")); - ?> -
- - - - - - - - - - - - -Цитадель Хаоса |
Следующий рейд начнется '.date("j.m в H:i",$cit_haos_t['value']).' |
Готовьтесь! Следующий рейд будет '.$d_o.' |
Рейд начинается '.date("j.m в H:i",$cit_haos_t['value']+900).' |