# Получаем IP
function getIPblock() {
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
return $_SERVER['REMOTE_ADDR'];
}
# Выполняем проверку безопасности.
if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('Hello pussy!'); }
if(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '91.228.152.24') {
die(getIPblock().'
'.$_SERVER['SERVER_ADDR']);
}
include('_incl_data/__config.php');
define('GAME',true);
include('_incl_data/class/__db_connect.php');
/*mysql_query("LOCK TABLES
`aaa_monsters` WRITE,
`actions` WRITE,
`bank` WRITE,
`battle` WRITE,
`battle_act` WRITE,
`battle_actions` WRITE,
`battle_cache` WRITE,
`battle_end` WRITE,
`battle_last` WRITE,
`battle_logs` WRITE,
`battle_logs_save` WRITE,
`battle_stat` WRITE,
`battle_users` WRITE,
`bs_actions` WRITE,
`bs_items` WRITE,
`bs_items_use` WRITE,
`bs_logs` WRITE,
`bs_map` WRITE,
`bs_statistic` WRITE,
`bs_trap` WRITE,
`bs_turnirs` WRITE,
`bs_zv` WRITE,
`clan` WRITE,
`clan_wars` WRITE,
`dungeon_actions` WRITE,
`dungeon_bots` WRITE,
`dungeon_items` WRITE,
`dungeon_map` WRITE,
`dungeon_now` WRITE,
`dungeon_zv` WRITE,
`eff_main` WRITE,
`eff_users` WRITE,
`items_img` WRITE,
`items_local` WRITE,
`items_main` WRITE,
`items_main_data` WRITE,
`items_users` WRITE,
`izlom` WRITE,
`izlom_rating` WRITE,
`laba_act` WRITE,
`laba_itm` WRITE,
`laba_map` WRITE,
`laba_now` WRITE,
`laba_obj` WRITE,
`levels` WRITE,
`levels_animal` WRITE,
`online` WRITE,
`priems` WRITE,
`quests` WRITE,
`reimage` WRITE,
`reg` WRITE,
`stats` WRITE,
`test_bot` WRITE,
`turnirs` WRITE,
`users` WRITE,
`users_animal` WRITE,
`user_ico` WRITE,
`users_twink` WRITE,
`zayvki` WRITE;");*/
function e($t) {
mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Критическая ошибка): '.mysql_real_escape_string($t).'","capitalcity","TABU","6","1","-1")');
}
if(isset($_GET['cron_core'])) {
$id = array(
'id' => $_GET['uid'],
'pass' => $_GET['pass']
);
if(md5($id['id'].'_brfCOreW@!_'.$id['pass']) == $_GET['cron_core']) {
$uzr = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "'.mysql_real_escape_string($id['id']).'" AND `pass` = "'.mysql_real_escape_string($id['pass']).'" LIMIT 1'));
if(isset($uzr['id'])) {
$CRON_CORE = true;
$_COOKIE['login'] = $uzr['login'];
$_COOKIE['pass'] = $uzr['pass'];
$_POST['id'] = 'reflesh';
if(isset($_GET['atack'])) {
$_POST['atack'] = $_GET['atack'];
}
if(isset($_GET['block'])) {
$_POST['block'] = $_GET['block'];
}
if(isset($_GET['usepriem'])) {
$_POST['usepriem'] = $_GET['usepriem'];
}
if(isset($_GET['useitem'])) {
$_POST['useitem'] = $_GET['useitem'];
}
}
}
}
if(!isset($uzr['id'])) {
header('location: main.php');
die();
}
unset($uzr);
include('_incl_data/class/__magic.php');
include('_incl_data/class/__user.php');
include('_incl_data/class/__filter_class.php');
include('_incl_data/class/__quest.php');
if($u->info['activ']>0) {
die('Вам необходимо активировать персонажа.
Авторизируйтесь с главной страницы.');
}
$tjs = '';
#--------для общаги, и позже для почты
$sleep = $u->testAction('`vars` = "sleep" AND `uid` = "'.$u->info['id'].'" LIMIT 1',1);
if($u->room['file']!="objaga" && $sleep['id']>0) {
mysql_query('UPDATE `actions` SET `vars` = "unsleep" WHERE `id` = "'.$sleep['id'].'" LIMIT 1');
}
if($u->room['file']=="objaga" || $u->room['file']=="post"){$trololo=0;}else{$trololo=1;}
#--------для общаги, и позже для почты
if($u->info['online'] < time()-60)
{
$filter->setOnline($u->info['online'],$u->info['id'],0);
mysql_query("UPDATE `users` SET `online`='".time()."',`timeMain`='".time()."' WHERE `id`='".$u->info['id']."' LIMIT 1");
}elseif($u->info['timeMain'] < time()-60)
{
mysql_query("UPDATE `users` SET `online`='".time()."',`timeMain`='".time()."' WHERE `id`='".$u->info['id']."' LIMIT 1");
}
if(!isset($u->info['id']) || ($u->info['joinIP']==1 && $u->info['ip']!=$_SERVER['HTTP_X_REAL_IP']) || $u->info['banned']>0)
{
die($c['exit']);
}
if(isset($_GET['atak_user']) && $u->info['battle'] == 0 && $_GET['atak_user']!=$u->info['id'] )
{
if($u->room['noatack'] == 0) {
$ua = mysql_fetch_array(mysql_query('SELECT `id`,`clan` FROM `users` WHERE`id` = "'.mysql_real_escape_string($_GET['atak_user']).'" LIMIT 1'));
$cruw = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_wars` WHERE
((`clan1` = "'.$ua['clan'].'" AND `clan2` = "'.$u->info['clan'].'") OR (`clan2` = "'.$ua['clan'].'" AND `clan1` = "'.$u->info['clan'].'")) AND
`time_finish` > '.time().' LIMIT 1'));
unset($ua);
if(isset($cruw['id'])) {
$cruw = 1;
}
$ua = mysql_fetch_array(mysql_query('SELECT `s`.`team`,`s`.`id`,`s`.`bbexp`,`u`.`battle`,`u`.`id`,`u`.`room`,`u`.`login`,`u`.`online` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `s`.`id` = `u`.`id` WHERE (`s`.`atack` > "'.time().'" OR `s`.`atack` = 1 OR 1 = '.$cruw.') AND `s`.`id` = "'.mysql_real_escape_string($_GET['atak_user']).'" LIMIT 1'));
if(isset($ua['id']) && $ua['online'] > time()-520)
{
$usta = $u->getStats($ua['id'],0); // статы цели
$minHp = $usta['hpAll']/100*33; // минимальный запас здоровья цели при котором можно напасть
if($ua['room']==$u->info['room'] && ($minHp<$usta['hpNow'] || $ua['battle']>0))
{
$magic->atackUser($u->info['id'],$ua['id'],$ua['team'],$ua['battle'],$ua['bbexp'],50);
$rtxt = '[img[items/pal_button8.gif]] "'.$u->info['login'].'" совершил'.$sx.' нападение по метке на персонажа "'.$ua['login'].'".';
mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1')");
header('location: main.php');
die();
}else{
if($ua['room']!=$u->info['room']){
//Персонаж в другой комнате
$u->error = 'Персонаж находится в другой комнате';
}else{
$u->error = 'Персонаж имеет слишком малый уровень жизней.';
}
}
}else{
//На персонажа нельзя напасть
$u->error = 'Персонаж не в игре, либо на нем нет метки';
}
}
$u->error = 'Вам запрещается атаковать без разрешения...';
}
//mysql_query('START TRANSACTION');
if($u->info['battle_text']!='')
{
//Показываем системку и заносим данные
if($u->info['last_b']>0)
{
mysql_query('INSERT INTO `battle_last` (`battle_id`,`uid`,`time`,`act`,`level`,`align`,`clan`,`exp`) VALUES ("'.$u->info['last_b'].'","'.$u->info['id'].'","'.time().'","'.$u->info['last_a'].'","'.$u->info['level'].'","'.$u->info['align'].'","'.$u->info['clan'].'","'.$u->info['exp'].'")');
}
mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}
/*echo '