' . $_SERVER['SERVER_ADDR']); } 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","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)) { $act = 0; if ($pl['online'] < time() - 60) { $pl['online'] = time(); mysql_query('UPDATE `users` SET `online` = "' . $pl['online'] . '" WHERE `id` = "' . $pl['id'] . '" 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 ("Внимание! ' . mysql_real_escape_string( str_replace( '{b}', '' . $pl['login'] . ' [' . $pl['level'] . ']', $mon['start_text'] ) ) . '","' . $pl['city'] . '","","6","1","' . time() . '")' ); } $act = 1; } } else { mysql_query( 'UPDATE `stats` SET `res_x` = "' . (time() + 3600) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' ); } } 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 ("Внимание! ' . mysql_real_escape_string( str_replace( '{b}', '' . $pl['login'] . ' [' . $pl['level'] . ']', $mon['back_text'] ) ) . '","' . $pl['city'] . '","","6","1","' . time() . '")' ); mysql_query( 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("Внимание! ' . mysql_real_escape_string( str_replace( '{b}', '' . $pl['login'] . ' [' . $pl['level'] . ']', $mon['back_text'] ) ) . '","' . $pl['city'] . '","","1","1","' . time() . '")' ); } $act = 2; } else { echo '[Ожидание: ' . $mon['id'] . ' -> ' . $mon['login'] . ' | ' . testMonster( $mon, 'back', true ) . ']
'; } } } usleep(300000); }