Файл: monst/index.php
Строк: 73
<?
$start_time = microtime(true);
error_reporting(-1);
ini_set('display_errors', 1);
session_start();
ob_start();
$URI = $_SERVER['REQUEST_URI'];
$index = array();
if ( substr($URI, 0, 3) == '/id' ) {
preg_match('//id([0-9]+)/', $URI, $id);
$id = (int)$id[1];
$index[0] = 'user';
} elseif( substr($URI, 0, 5) == '/item' ) {
preg_match('//item([0-9]+)/', $URI, $id);
$id = (int)$id[1];
$index[0] = 'item';
} else {
$array = explode('?', $URI);
$pat = $array[0];
#$stri = ( !empty($array[1]) ? $array[1] : 0 );
if ( $pat ) {
$array = explode('/', $pat);
for ( $i = 0; $i <= count($array) - 1; $i++ ) {
if ( isset($array[$i - 1]) ) {
$index[$i - 1] = $array[$i];
}
}
}
}
$HOME = $_SERVER['DOCUMENT_ROOT'];
include $HOME . '/core/in/mem.php';
include $HOME . '/core/in/fnct.php';
include $HOME . '/core/in/db.php';
//include $HOME . '/core/in/get_useragent.php';
$user_agent = null_html($_SERVER['HTTP_USER_AGENT']);
if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) ) { # miniopera real ip
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif ( isset($_SERVER['HTTP_CF_CONNECTING_IP'] ) ) { # cloudflare
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
if ( isset($_GET['exit']) ) {
session_destroy();
Cook_del('id');
Cook_del('pass');
g('/');
}
include $HOME . '/core/file/simple.php';
if ( empty($index[0]) OR ( !empty($index[0]) AND !file_exists($HOME . '/core/pag/'.$index[0].'.php')) ) {
$index[0] = 'index';
}
$no_aut_pag = array('index', 'start', 'login');
if ( !in_array($index[0], $no_aut_pag) ) {
$user = User_get();
if ( !$user ) {
g('/?error=login');
}
}
//$lang_list = array('ru' => 'Русский', 'en' => 'English');
$lang_list = array('ru' => 'Русский');
if ( isset($_GET['lang'] ) ) {
$l = $_GET['lang'];
if ( $l != 'ru' AND $l != 'en' ) {
$l = 'ru';
}
$_SESSION['lang'] = $l;
}
if ( isset($_SESSION['lang'] ) ) {
$L = $_SESSION['lang'];
} else {
$_SESSION['lang'] = 'ru';
$L = 'ru';
}
$lang = array();
$dir = opendir($HOME . '/core/lang/' . $L);
if ( $index[0] == 'index' ) {
include $HOME . '/core/lang/' . $L . '/html.php';
include $HOME . '/core/lang/' . $L . '/page.index.php';
} else {
while ( $file = readdir($dir) ) {
if ( $file != '.' AND $file != '..' ) {
if ( substr($file, 0, 5) == 'page.' ) {
if ( $file == 'page.'.$index[0].'.php') {
include $HOME . '/core/lang/' . $L . '/' . $file;
}
} else {
include $HOME . '/core/lang/' . $L . '/' . $file;
}
}
}
}
if ( isset($user['ok_id']) AND !empty($user['ok_id']) ) {
if ( !isset($_SESSION['ok__session_key']) OR empty($_SESSION['ok__session_key']) ) {
g('http://m.ok.ru/game/monst');
}
}
header('Content-type: text/html; charset=UTF-8');
include $HOME . '/core/s/html.php';
include $HOME . '/core/pag/' . $index[0] . '.php';
include $HOME . '/core/s/footer.php';