game/cron_h.php
2022-12-19 20:26:14 +02:00

78 lines
3.1 KiB
PHP

<?php
die('×òî-òî òóò íå òàê...');
function getIP() {
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
return $_SERVER['REMOTE_ADDR'];
}
# Ïîëó÷àåì 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() != '5.187.7.71') {
die(getIPblock().'<br>'.$_SERVER['SERVER_ADDR']);
}
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","ENERGY STAR","6","1","-1")');
}
function send_chat($type,$from,$text,$time) {
mysql_query('INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("'.mysql_real_escape_string($text).'","capitalcity","'.mysql_real_escape_string($from).'","","'.$type.'","1","'.mysql_real_escape_string($time).'","3")');
}
/* Áàáà ìàíÿ */
function many_start() {
$qtext = '';
$atext = '';
$msec = 120;
$lmvc = array();
$lmv = mysql_query('SELECT `id` FROM `aaa_many` WHERE `time` < "'.(time()-86400).'" ORDER BY `time` ASC');
while( $plmv = mysql_fetch_array($lmv) ) {
$lmvc[] = $plmv['id'];
}
$lmvc = $lmvc[rand(0,(count($lmvc)-1))];
$lmv = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_many` WHERE `id` = "'.$lmvc.'" LIMIT 1'));
if( isset($lmv['id']) ) {
$qtext = $lmv['text'];
$atext = $lmv['answer'];
mysql_query('UPDATE `aaa_many` SET `time` = "'.time().'" WHERE `id` = "'.$lmv['id'].'" LIMIT 1');
}
if( $qtext != '' ) {
$qtext = str_replace('"','&quot;',$qtext);
$qtext = str_replace("'",'&quot;',$qtext);
$qtext = str_replace('<','&lt;',$qtext);
$qtext = str_replace('>','&gt;',$qtext);
$qtext = str_replace('
',' ',$qtext);
$qtext = str_replace("\r",' ',$qtext);
$qtext = str_replace('ñ','c',$qtext);
$qtext = str_replace('õ','x',$qtext);
$qtext = str_replace('ó','y',$qtext);
$qtext = str_replace('å','e',$qtext);
$qtext = str_replace('î','o',$qtext);
$qtext = str_replace('ð','p',$qtext);
$qtext = str_replace('è','u',$qtext);
mysql_query('UPDATE `users` SET `online` = "'.time().'" WHERE `id` = 1003553 LIMIT 1');
send_chat(1,'Áàáà Ìàíÿ','<font color=#cb0000><b>Âíèìàíèå!</b> Ïðîâîäèòñÿ âèêòîðèíà! Ïåðâîìó, êòî ïðàâèëüíî îòâåòèò íà ñëåäóþùèé âîïðîñ áóäåò âûïëà÷åí äåíåæíûé ïðèç. Âðåìÿ îæèäàíèÿ îòâåòà '.$msec.' ñåêóíä. Âàøè îòâåòû ïèøèòå â ÷àò <b>to [Áàáà Ìàíÿ]</b>. Âíèìàíèå, âîïðîñ: <b>'.$qtext.'</b></font>',time());
mysql_query('INSERT INTO `aaa_many_now` (`qid`,`time`) VALUES ("'.$lmv['id'].'","'.(time()+$msec).'")');
send_chat(1,'Áàáà Ìàíÿ','<font color=red>Íèêòî íå óãàäàë! Ïðàâèëüíûé îòâåò: <b>'.$atext.'</b></font>.',-(time()+$msec));
}
}
many_start();
?>