Вход Регистрация
Файл: pesn_voini/peseni_vojni/instalscript/engine/_inc/sys.php
Строк: 331
<?
// 3020.ru - скрипты скачать можно тут
error_reporting(E_ALL E_NOTICE E_WARNING); // Отключает ошибки
/*
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
*/
session_start(); // запускаем ссесию
ob_start(); // включаем буферизацию вывода, нужно для заголовков header
mb_internal_encoding("UTF-8"); // внутренния кодировка сайта



function is($i){
    
$is explode("/",checking($_GET['is']));
    return 
$is[$i];
}



require_once(
$_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/mysql.php"); // Подлключение БД



function _rand(){
    
$r mt_rand(1000,10000);
    return 
$r;
}



function 
jQueryConnection(){
echo 
"
    <script src = '/instalscript/script/jquery-2.1.4.js'></script>
"
;
// Подключение библиотеки jQuery, для асинхронной работы со страницами и не только



function logi($log){if($log != null){$_SESSION['log'][] = $log;}}
function 
logs(){
$count count($_SESSION['log']);for($i '0';$i <= $count;$i++){$text $text."<div>".$_SESSION['log'][$i]."</div>";}
if(
$count '0'){
return 
$text.logn();
}
}
function 
logn(){unset($_SESSION['log']);}

function 
err($err){
    if(
$err != null){
        
logi("<div class = 'err'>".$err."</div>");
    }
}
function 
msg($msg){
    if(
$msg != null){
        
logi("<div class = 'msg'>".$msg."</div>");
    }
}




function 
retranslitEng($text){
$a1 = array("'",'`',',',' ',"Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы");
$a2 = array('_','_','_','_',"JO","ZH","CH","SH","SCH","Je","Jy","Ja","jo","zh","ch","sh","sch","je","jy","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","","y");
return 
str_replace($a1,$a2,$text);
}
function 
retranslitRus($text){
$a1 = array("JO","ZH","CH","SH","SCH","Je","Jy","Ja","jo","zh","ch","sh","sch","je","jy","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","","y");
$a2 = array("Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы");
return 
str_replace($a1,$a2,$text);
}

function 
capsSmall($text){
$a1= array("Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L","Z","X","C","V","B","N","M","Й","Ц","У","К","Е","Н","Г","Ш","З","Ъ","Ф","Ы","В","А","П","Р","О","Л","Д","Ж","Э","Я","Ч","С","М","И","Т","Ь","Б","Ю");
$a2= array("q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","й","ц","у","к","е","н","г","ш","з","ъ","ф","ы","в","а","п","р","о","л","д","ж","э","я","ч","с","м","и","т","ь","б","ю");
return 
str_replace($a1,$a2,$text);
}
function 
capsBig($text){
$a1 = array("q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","й","ц","у","к","е","н","г","ш","з","ъ","ф","ы","в","а","п","р","о","л","д","ж","э","я","ч","с","м","и","т","ь","б","ю");
$a2 = array("Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L","Z","X","C","V","B","N","M","Й","Ц","У","К","Е","Н","Г","Ш","З","Ъ","Ф","Ы","В","А","П","Р","О","Л","Д","Ж","Э","Я","Ч","С","М","И","Т","Ь","Б","Ю");
return 
str_replace($a1,$a2,$text);
}



function 
page($num,$str,$result){
// обработчик страниц
$num number($num);
if(
$num '1'){$num '1';}$start $str $num $str;
$endpage ceil($result/$str);
if(
$num $endpage){$start '0';}
return 
$start;
}
function 
ppage($url,$num,$str,$result){

    
// панель страниц
    
$num number($num); // текущая страница
    
$endpage ceil($result/$str); // последняя страница

    
if($endpage '1'){$endpage '1';}
    if(
$endpage $num or $num '1'){$num '1';};

    if(
$str $result){

    echo 
"
    <div class = 'pages'>
    "
;

    
$n_4 number($num 4);
    
$n_3 number($num 3);
    
$n_2 number($num 2);
    
$n_1 number($num 1);
    
$n1 '1';
    
$p1 number($num 1);
    
$p2 number($num 2);
    
$p3 number($num 3);
    
$p4 number($num 4);


    if(
$num != '1'){
        echo 
"<a class = 'page' href = '".$url.$n1."/' data-page = '".$n1."'><</a> ";
    }
    else{
        echo 
"<span class = 'page-current'><</span> ";
    }
    if(
$num '4' && $endpage $num){
        echo 
"<a title = 'Перейти на страницу ".($n_4)."' class = 'page' href = '".$url.$n_4."/' data-page = '".$n_4."'>".$n_4."</a> ";
    }
    if(
$num '3' && $endpage $num){
        echo 
"<a title = 'Перейти на страницу ".($n_3)."' class = 'page' href = '".$url.$n_3."/' data-page = '".$n_3."'>".$n_3."</a> ";
    }
    if(
$num '2'){
        echo 
"<a title = 'Перейти на страницу ".($n_2)."' class = 'page' href = '".$url.$n_2."/' data-page = '".$n_2."'>".$n_2."</a> ";
    }
    if(
$num '1'){
        echo 
"<a title = 'Перейти на страницу ".($n_1)."' class = 'page' href = '".$url.$n_1."/' data-page = '".$n_1."'>".$n_1."</a> ";
    }

    echo 
" <span class = 'page-current'>".$num."</span> ";

    if(
$endpage $num){
        echo 
"<a class = 'page' href = '".$url.$p1."/' data-page = '".$p1."'>".$p1."</a> ";
    }
    if(
$endpage $num){
        echo 
"<a class = 'page' href = '".$url.$p2."/' data-page = '".$p2."'>".$p2."</a> ";
    }
    if(
$endpage $num && $num <= '2'){
        echo 
"<a class = 'page' href = '".$url.$p3."/' data-page = '".$p3."'>".$p3."</a> ";
    }
    if(
$endpage $num && $num <= '1'){
        echo 
"<a class = 'page' href = '".$url.$p4."/' data-page = '".$p4."'>".$p4."</a> ";
    }

    if(
$endpage != $num){
        if(
$endpage $num){
        echo 
"<a title = 'Перейти на страницу ".($endpage)."' class = 'page' href = '".$url.$endpage."/' data-page = '".$endpage."'>".$endpage."</a> ";
        }
        echo 
"<a class = 'page' href = '".$url.$endpage."/' data-page = '".$endpage."'>></a> ";
    }
    else{
        echo 
"<span class = 'page-current'>></span> ";
    }
    echo 
"</div>";
    }


}


//обрезаем текст
function text_msg$text$maxwords 100$maxchar 105 ){
$sep=' ';
$words explode($sep,$text);
$char iconv_strlen($text,'utf-8');
if (
count($words) > $maxwords){
$text join($separray_slice($words0$maxwords));
}
if ( 
$char $maxchar ){
$sep2='...';
$text iconv_substr$text0$maxchar'utf-8' );
}
return 
$text;
}
//

function clock($time=NULL){
// Функция из движка DCMS (там называется vremja() )
global $user;
if (
$time==NULL)$time=time();
if (isset(
$user))$time=$time+60*60;
$timep="".date("j M Y в H:i"$time)."";
$time_p[0]=date("j n Y"$time);
$time_p[1]=date("H:i"$time);
if (
$time_p[0]==date("j n Y"))$timep date("H:i:s"$time);
if (isset(
$user)){
if (
$time_p[0]==date("j n Y"time()+60*60))$timep "Сегодня в ".date("H:i:s"$time);
if (
$time_p[0]==date("j n Y"time()-60*60*24))$timep="Вчера в $time_p[1]";}
else{
if (
$time_p[0]==date("j n Y"))$timep=date("H:i:s"$time);
if (
$time_p[0]==date("j n Y"time()-60*60*24))$timep="Вчера в $time_p[1]";}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return 
$timep;
}
function 
clockLog($time=NULL){
// Функция из движка DCMS (там называется vremja() )
global $user;
if (
$time==NULL)$time=time();
if (isset(
$user))$time=$time*60*60;
$timep="".date("j M Y в H:i"$time)."";
$time_p[0]=date("j n Y"$time);
$time_p[1]=date("H:i"$time);
if (
$time_p[0]==date("j n Y"))$timep date("H:i:s"$time);
if (isset(
$user)){
if (
$time_p[0]==date("j n Y"time()*60*60))$timep "".date("H:i:s"$time);
if (
$time_p[0]==date("j n Y"time()-60*60*24))$timep="Вчера в $time_p[1]";}
else{
if (
$time_p[0]==date("j n Y"))$timep=date("H:i:s"$time);
if (
$time_p[0]==date("j n Y"time()-60*60*24))$timep="Вчера в $time_p[1]";}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return 
$timep;
}
function 
timer($var){
    
$timer $var time();
    
$isDay floor($timer/86400);
    
$isHour floor($timer/3600);
    
$isMin floor($timer/60);
    
$hourOs $isHour  - ($isDay*24); // Остаток часов от дня
    
$minOs $isMin  - ($isHour 60); // Остаток минут от часов
    
$secOs $timer  - ($isMin 60); // остаток секунд от часов
    
if($isDay '0'){$day $isDay." д ";}
    if(
$hourOs '0'){$hour $hourOs." ч ";}
    if(
$minOs '0'){$minute $minOs." м ";}
    if(
$secOs '0'){$sec $secOs ." с ";}
    
$times $day.$hour.$minute.$sec;
    return 
$times;
}


function 
month($i){
$month = array("1" => "Январь","2" => "Февраль","3" => "Март","4" => "Апрель","5" => "Май","6" => "Июнь","7" => "Июль","8" => "Август","9" => "Сентябрь","10" => "Октябрь","11" => "Ноябрь","12" => "Декабрь");
return 
$month[$i];
}

function 
GnEng($length){
$b = array("1" => "q","2" => "w","3" => "e","4" => "r","5" => "t","6" => "y","7" => "u","8" => "i","9" => "o","10" => "p","11" => "a","12" => "s","13" => "d","14" => "f","15" => "g","16" => "h","17" => "j","18" => "k","19" => "l","20" => "z","21" => "x","22" => "c","23" => "v","24" => "b","25" => "n","26" => "m");
for(
$i '1';$i <= $length;$i++){
$key $key.$b[mt_rand(1,24)];
}
return 
$key;
}
function 
forumInfo($id,$e){
$e explode("/",$e);
$q mysql_fetch_assoc(mysql_query("SELECT * FROM `".checking($e['0'])."` WHERE `id` = '".number($id)."' "));
return 
$q[$e['1']];
}
function 
renum($num){
if(
$num >= '1000' && $num '1000000'){$num round($num/1000,2)."k";}
elseif(
$num >= '1000000' && $num '1000000000'){$num round($num/1000000,2)."m";}
elseif(
$num >= '1000000000' && $num '1000000000000'){$num round($num/1000000000,2)."g";}
elseif(
$num >= '1000000000000'){$num round($num/1000000000000,2)."T";}
return 
$num;
}





function 
bbcode($text){

$str_search = array(
"/[(/?)(br|b|i|u|s)s*]/",
"#[sm(.+?)]#is",
"#[div class = (.+?)](.+?)[/div]#is",
"#[span class = (.+?)](.+?)[/span]#is",
"#///n#is",

"#[code](.+?)[/code]#is",
"#[quote](.+?)[/quote]#is",
"#[url=(.+?)](.+?)[/url]#is",
"#[url](.+?)[/url]#is",
"#[img](.+?)[/img]#is",
"#[size=(.+?)](.+?)[/size]#is",
"#[color=(.+?)](.+?)[/color]#is",
"#[list](.+?)[/list]#is",
"#[listn](.+?)[/listn]#is",
"#[*](.+?)[/*]#"
);
$str_replace = array(
"<$1$2>",
"<img src = '/instalscript/images/icons/emoji/\1.png'>",
"<div class = '\1'>\2</div>",
"<span class = '\1'>\2</span>",
"<br/>",
"<code class='code'>\1</code>",
"<table width = '95%'><tr><td>Цитата</td></tr><tr><td class='quote'>\1</td></tr></table>",
"<a href = '\1'>\2</a>",
"<a href = '\1'>\1</a>",
"<img src = '\1' alt = 'Изображение' />",
"<span style = 'font-size:\1%'>\2</span>",
"<font color = '\1'>\2</font>",
"<ul>\1</ul>",
"<ol>\1</ol>",
"<li>\1</li>"
);
return 
preg_replace($str_search$str_replace$text);

}

// Второстепенные функции


require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/fnc/user.php"); // Пользователь
require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/str/head.php"); // Голова
require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/str/body.php"); // Тело
require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/str/foot.php"); // Ноги
require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/fnc/user_level.php"); // level user
//
//
//Задания
//
$yyy $BaseConnect->query("SELECT * FROM `quest` ORDER BY `id` ASC"); 
//
while($post $yyy->fetch(PDO::FETCH_ASSOC)){
//
$quest fch("SELECT * FROM `quest_user` WHERE `id_quest` = ? AND `id_user` = ? ORDER BY `id` DESC LIMIT 1", array($post['id'],$uid));
//
if(!$quest && $uid >= 1){
//
qry("INSERT INTO `quest_user` SET `id_user` = ?, `id_quest` = ?, `max_koll` = ?", array($uid,$post['id'],$post['koll']));
//
}
}
//
//
$ban fch("SELECT * FROM `ban` WHERE `id_user` = ? AND `time` > ? ORDER BY `id` DESC  LIMIT 1", array($uid,time()));
//
//
$dat = array('1' => 'Реклама / Спам''2' => 'Мат''3' => 'Продажа / Покупка персонажа''4' => 'Продажа / Покупка гильдии',  '5' => 'Использование багов');
//
//
$dat2 = array('1' => 'Молчанка''2' => 'Блокировка');
//
//
if($ban['tipe'] == && $ban['time'] > time()){
//
//
head("Блокировка",$uid); # Голова
//
//
echo '<div class="message cntr">Ваш ваш аккаунт был заблокирован администрацией</div>';
echo 
'<div class="message">Забанил: '.user_list($ban['adm']).'<br>';
echo 
'Причина: '.$dat[$ban['cause']].'<br>Осталось: '.timer($ban['time']).'</div><br><a href="?" class="lnk ma cntr">Обновить</a>';
//
//
exit();
}
//
//
$tex fch("SELECT * FROM `tex_rab` WHERE `id` = ? LIMIT 1", array(1));
//
//
if($tex['on'] == && $user['adm'] <= 2){
//
//
head("Тех. Работы",$uid); # Голова
//
//
echo '<div class="message cntr">На сервере ведутся технические работы, игра станет доступна в ближайшее время.</div><br><a href="?" class="lnk ma cntr">Обновить</a>';
//
//
exit();
}
//
//
if($user['energy'] > $user['energy_max']){
qry("UPDATE `users` SET `energy` = ? WHERE `id` = ? LIMIT 1", array($user['energy_max'],$uid));
}
//
if($user['mess'] == && $user['mess_time'] <= time()){
qry("UPDATE `users` SET `power` = `power` - ?, `block` = `block` - ?, `health` = `health` - ?, `mess` = ? WHERE `id` = ? LIMIT 1", array(250,250,250,0,$uid));
}
//
//
//
//
if($user['premium'] == && $user['premium_time'] <= time()){
qry("UPDATE `users` SET `premium` = ? WHERE `id` = ? LIMIT 1", array(1,$uid));
}
//
// 
$rune fch("SELECT * FROM `user_rune` WHERE `id_user` = ? LIMIT 1", array($uid)); //проверяем запись в бд 
// 
if(!$rune && $uid >= 1){ //нет записи, создаем 
qry("INSERT INTO `user_rune` SET `id_user` = ?", array($uid));  

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