190 lines
7.6 KiB
PHP
190 lines
7.6 KiB
PHP
<?php
|
|
|
|
function getIP() {
|
|
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|
return $_SERVER['REMOTE_ADDR'];
|
|
}
|
|
|
|
if(!isset($_GET['test']))
|
|
{
|
|
/*if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' )
|
|
{
|
|
die('<center><br><h3>½ðîäè ;)</h3><img src="i/fack.jpg">');
|
|
}*/
|
|
if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP() != '31.131.97.206')
|
|
{
|
|
die(getIP().'<br>'.$_SERVER['SERVER_ADDR']);
|
|
}
|
|
}
|
|
/*
|
|
if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('<center><br><h3>½ðîäè ;)</h3><img src="i/fack.jpg">'); }
|
|
}*/
|
|
|
|
|
|
|
|
define('GAME',true);
|
|
|
|
require_once('_incl_data/__config.php');
|
|
require_once('_incl_data/class/__db_connect.php');
|
|
|
|
function e($t) {
|
|
mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' ( ðèòè÷åñêठîøèáêà): <b>'.mysql_real_escape_string($t).'</b>","capitalcity","LEL","6","1","-1")');
|
|
}
|
|
|
|
function testMonster( $mon , $type , $mbk ) {
|
|
$r = true;
|
|
$mbk2 = '';
|
|
if(isset($mon['id'])) {
|
|
//
|
|
if($type == 'start') {
|
|
//?åíü íåäåëè
|
|
if( $mon['start_day'] != -1 ) {
|
|
if( ($mon['start_day'] < 7 && $mon['start_day'] != (int)date('w')) || $mon['start_day'] != 7 ) {
|
|
$r = false;
|
|
$mbk2 .= '(íåäåëÿ)';
|
|
}
|
|
}
|
|
//?èñëî
|
|
if( $mon['start_dd'] != -1 ) {
|
|
if( $mon['start_dd'] != date('j') ) {
|
|
$r = false;
|
|
$mbk2 .= '(÷èñëî)';
|
|
}
|
|
}
|
|
//ìåñ²ö
|
|
if( $mon['start_mm'] != -1 ) {
|
|
if( $mon['start_mm'] != date('n') ) {
|
|
$r = false;
|
|
$mbk2 .= '(ìåñÿö)';
|
|
}
|
|
}
|
|
//÷àñ
|
|
if( $mon['start_hh'] != -1 ) {
|
|
if( $mon['start_hh'] != (int)date('H') ) {
|
|
$r = false;
|
|
$mbk2 .= '('.$mon['start_hh'].'|'.((int)date('H')).' ÷àñ)';
|
|
}
|
|
if( $mon['start_min'] != -1 ) {
|
|
if( $mon['start_min'] < (int)date('i') ) {
|
|
$r = false;
|
|
$mbk2 .= '('.$mon['start_min'].'|'.((int)date('i')).' ìèíóòû)';
|
|
}
|
|
}
|
|
}
|
|
}elseif($type == 'back') {
|
|
//?åíü íåäåëè
|
|
if( $mon['back_day'] != -1 ) {
|
|
if( ($mon['back_day'] < 7 && $mon['back_day'] != date('w')) || $mon['back_day'] != 7 ) {
|
|
$r = false;
|
|
$mbk2 .= '(äåíü íåäåëè)';
|
|
}
|
|
}
|
|
//?èñëî
|
|
if( $mon['back_dd'] != -1 ) {
|
|
if( $mon['back_dd'] != date('j') ) {
|
|
$r = false;
|
|
$mbk2 .= '(÷èñëî)';
|
|
}
|
|
}
|
|
//ìåñ²ö
|
|
if( $mon['back_mm'] != -1 ) {
|
|
if( $mon['back_mm'] != date('n') ) {
|
|
$r = false;
|
|
$mbk2 .= '(ìåñÿö)';
|
|
}
|
|
}
|
|
//÷àñ
|
|
if( $mon['back_hh'] != -1 ) {
|
|
if( $mon['back_hh'] != (int)date('H') ) {
|
|
$r = false;
|
|
$mbk2 .= '(÷àñ)';
|
|
}
|
|
if( $mon['back_min'] != -1 ) {
|
|
if( $mon['back_min'] < (int)date('i') ) {
|
|
$r = false;
|
|
$mbk2 .= '(ìèíóòû)';
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
//÷òî-òî äðóãîå
|
|
$r = false;
|
|
$mbk2 .= '(÷òî-òî äðóãîå)';
|
|
}
|
|
//
|
|
}
|
|
if( $mbk == true ) {
|
|
return $mbk2;
|
|
}else{
|
|
return $r;
|
|
}
|
|
}
|
|
|
|
$sp = mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `st`.`id` = `u`.`id` WHERE `u`.`no_ip` = "trupojor" LIMIT 100');
|
|
while($pl = mysql_fetch_array($sp)) {
|
|
/*echo "ID:".$pl['id']."<br>";
|
|
echo "online:".$pl['online']."<br>";
|
|
$testtime=time()-60;
|
|
echo "time:".$testtime."<br>";*/
|
|
$act = 0;
|
|
if($pl['online'] < time()-60) {
|
|
$pl['online'] = time();
|
|
mysql_query('UPDATE `users` SET `online` = "'.$pl['online'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
}
|
|
|
|
//$testb=mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `type` = 500 AND `team_win` = -1 LIMIT 1'));
|
|
if($pl['res_x'] < time() /*&& !isset($testb['id'])*/) {
|
|
//¸îæíî äåéñòâîâàòü!
|
|
$mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "'.$pl['id'].'" LIMIT 1'));
|
|
if( isset($mon['id']) ) {
|
|
if( testMonster($mon,'start',false) == true && $pl['room'] == 303 ) {
|
|
$pl['room'] = $mon['start_room'];
|
|
mysql_query('UPDATE `users` SET `room` = "'.$pl['room'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
mysql_query('UPDATE `stats` SET `hpNow` = "1000000000000",`mpNow` = "1000000000000" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
if( $mon['start_text'] != '' /*&& $pl['level'] <10*/) {
|
|
mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> '.mysql_real_escape_string(str_replace('{b}','<b>'.$pl['login'].'</b> ['.$pl['level'].']<a target=_blank href=inf.php?'.$pl['id'].' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',$mon['start_text'])).'","'.$pl['city'].'","","6","1","'.time().'")');
|
|
//mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> '.mysql_real_escape_string(str_replace('{b}','<b>'.$pl['login'].'</b> ['.$pl['level'].']<a target=_blank href=inf.php?'.$pl['id'].' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',$mon['start_text'])).'","'.$pl['city'].'","","1","1","'.time().'")');
|
|
}
|
|
$act = 1;
|
|
}
|
|
}else{
|
|
mysql_query('UPDATE `stats` SET `res_x` = "'.(time()+3600).'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
}
|
|
}
|
|
|
|
//e('['.date('d.m.Y H:i:s').'] TRUPOJOR -> '.$pl['login'].' -> [room: '.$pl['room'].' , test: '.testMonster($mon,'start',true).' , res_x: '.$pl['res_x'].' , battle: '.$pl['battle'].' , act: '.$act.' ]');
|
|
|
|
if( $act == 0 && $pl['room'] != 303 && $pl['battle'] == 0 ) {
|
|
if(!isset($mon['id'])) {
|
|
$mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "'.$pl['id'].'" LIMIT 1'));
|
|
}
|
|
if( isset($mon['id']) ) {
|
|
if( testMonster($mon,'back',false) == true ) {
|
|
$pl['room'] = 303;
|
|
mysql_query('UPDATE `users` SET `room` = "'.$pl['room'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
mysql_query('UPDATE `stats` SET `hpNow` = "1000000000000",`mpNow` = "1000000000000" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
if( $mon['back_text'] != '' ) {
|
|
mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> '.mysql_real_escape_string(str_replace('{b}','<b>'.$pl['login'].'</b> ['.$pl['level'].']<a target=_blank href=inf.php?'.$pl['id'].' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',$mon['back_text'])).'","'.$pl['city'].'","","6","1","'.time().'")');
|
|
mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> '.mysql_real_escape_string(str_replace('{b}','<b>'.$pl['login'].'</b> ['.$pl['level'].']<a target=_blank href=inf.php?'.$pl['id'].' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',$mon['back_text'])).'","'.$pl['city'].'","","1","1","'.time().'")');
|
|
}
|
|
$act = 2;
|
|
}else{
|
|
echo '[Îæèäàíèå: '.$mon['id'].' -> '.$mon['login'].' | '.testMonster($mon,'back',true).']<br>';
|
|
}
|
|
}
|
|
}
|
|
/*if($pl['battle'] > 0) {
|
|
//inuser_go_atack($pl);
|
|
}else{
|
|
if($pl['room'] == 303 && $pl['timeGo'] < time()) {
|
|
if($pl['res_x'] < time()) {
|
|
$pl['room'] = $pl['invBlock'];
|
|
mysql_query('UPDATE `users` SET `room` = "'.$pl['room'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
mysql_query('UPDATE `stats` SET `hpNow` = "1000000000000",`mpNow` = "1000000000000" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Ðíèìàíèå!</font> <b>'.$pl['login'].'</b> ['.$pl['level'].']<a target=_blank href=inf.php?'.$pl['id'].' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a> âûáðàëñ² íà îõîòó, áóäüòå îñòîðîæíû!","'.$pl['city'].'","","6","1","'.time().'")');
|
|
}
|
|
}
|
|
}*/
|
|
usleep(300000);
|
|
}
|
|
?>
|