Вход Регистрация
Файл: core/core.php
Строк: 84
<?
# CORE BY TERRIN v2.0 #

# MAINDIR LEVEL #
$level 0;
$folder_level '';
while (!
file_exists($folder_level.'input.php') && $level 5) {
$folder_level .= '../';
++
$level;

unset(
$level);
define('MAINDIR'$folder_level);
include(
MAINDIR.'sys/pdo_class.php');
if(!
mysql_connect(DBHOST,DBUSER,DBPASS))
die(
'Не удалось подключиться к серверу MySql!');
elseif(!
mysql_select_db(DBNAME))
die(
'Не удалось выбрать БД!');
mysql_query("SET NAMES 'utf8';");

# FUNCTUONS ON SITE 
function check($msg) {
    if (
is_array($msg)) {
        foreach(
$msg as $key => $val) {
            
$msg[$key] = check($val);
        } 
    } else {
        
$msg htmlspecialchars($msg);
        
$search = array('|'''', '$', '\', '^', '%', '`', "", "x00", "x1A", chr(226) . chr(128) . chr(174));
        
$replace = array('&#124;', '&#39;', '&#36;', '&#92;', '&#94;', '&#37;', '&#96;', '', '', '', '');

        
$msg = str_replace($search$replace$msg);
        
$msg = stripslashes(trim($msg));
    } 

    return 
$msg;



function is_user(){
$login = check($_COOKIE['login']);
$pass = check($_COOKIE['pass']);
$pri = NULL;
$login_in = DB::run() -> queryFetch("SELECT * FROM `users` WHERE `login`=? LIMIT 1;", array($login));

if(!empty(
$login_in['login']) && !empty($login_in['pass'])){
if(
$pass == $login_in['pass'] && $login == $login_in['login']){
$pri = $login;
}
}
return 
$pri;
}

function is_admin(
$access = array()) {
    if (empty(
$access)) {
        
$access = array(101, 102, 103, 104);
    } 

    if (is_user()) {
    
$login = check($_COOKIE['login']);

    
$login_in = DB::run() -> queryFetch("SELECT * FROM `users` WHERE `login`=? LIMIT 1;", array($login));
        if (in_array(
$login_in['status'], $access)) {
            return true;
        } 
    } 

    return false;
}

# GZIP LEVEL 6 ! #
$step_gzip = 6;
if(
$step_gzip > 0 && $step_gzip <= 9){
$step = $step_gzip;
if(
$_SERVER['HTTP_ACCEPT_ENCODING'])//Узнаем какие типы сжатия поддерживает браузер
$compress = strtolower($_SERVER['HTTP_ACCEPT_ENCODING']); }else{ $compress = strtolower($_SERVER['HTTP_TE']); }
}else{ 
$compress = "fgjdfgfg"; }
// Если поддерживается deflate
if(substr_count(
$compress,'deflate')){
function compress_output_deflate(
$output){
global 
$step;
return gzdeflate(
$output$step);}
$method = 'deflate';
   header('Content-Encoding: deflate');
   ob_start('compress_output_deflate');
   ob_implicit_flush(0);}
// Если поддерживается gzip
elseif(substr_count(
$compress,'gzip')){
function compress_output_gzip(
$output){
global 
$step;
return gzencode(
$output$step); }
$method = 'gzip';
header('Content-Encoding: gzip');
ob_start('compress_output_gzip');
ob_implicit_flush(0);}
// Если поддерживается x-gzip
elseif(substr_count(
$compress,'x-gzip')){
function compress_output_x_gzip(
$output){
global 
$step;
$size = strlen($output);
$crc = crc32($output);
$output = gzcompress($output$step);
$output = substr($output, 0, strlen($output) - 4);
return "x1fx8bx08x00x00x00x00x00".
$output.pack('V',$crc).pack('V',$size);}
$method = 'x-gzip';
header('Content-Encoding: x-gzip');
ob_start('compress_output_x_gzip');
ob_implicit_flush(0);}

# INCLUDE NO ALL PAGE #
include(MAINDIR.'sys/func.php');
include(MAINDIR.'sys/ban.php');
include(MAINDIR.'sys/global_config.php');
include(MAINDIR.'sys/session.php');
include(MAINDIR.'sys/session_user.php');


$mode = htmlspecialchars($_GET['mode']);

?>
Онлайн: 2
Реклама