45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
# Ïîëó÷àåì IP
|
|
function getIPblock()
|
|
{
|
|
return isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_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']);
|
|
}
|
|
|
|
const GAME = true;
|
|
|
|
include('_incl_data/__config.php');
|
|
include('_incl_data/class/__db_connect.php');
|
|
/**@var $pdo PDO */
|
|
$zv = new FightRequest();
|
|
|
|
function send_chat($type, $from, $text, $time)
|
|
{
|
|
global $pdo;
|
|
$pdo->prepare('insert into chat (text, city, login, type, new, time, room) values (?,?,?,?,?,?,?)')->execute([$text, 'capitalcity', $from, $type, 1, $time, 3]);
|
|
}
|
|
|
|
function inuser_go_btl($id)
|
|
{
|
|
if (isset($id['id'])) {
|
|
echo file_get_contents('https://new-combats.com/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass']);
|
|
echo '<hr>';
|
|
}
|
|
}
|
|
|
|
$sp = $pdo->query('select id, pass from users where battle in (select id from battle where team_win = -1 and time_over = 0 and time_start < unix_timestamp() - 3600 limit 100)');
|
|
foreach ($sp as $pl) {
|
|
inuser_go_btl($pl);
|
|
}
|
|
|
|
$zv->testCronZv();
|