Вход Регистрация
Файл: weatut.ru/system/func.php
Строк: 391
<?php



$mc 
mysql_connect('localhost''xaker_169_parviz''N844tjZg9UkU') or die('<center>Сайт будет доступен через минут 5)Всё нормально)просто убираем 1 баг!)</center>');
mysql_query('SET NAMES `utf8`'$mc);
mysql_select_db('xaker_169_yed9t1'$mc) or die('Указанная таблица не найдена');
##################
##### СЕССИИ #####
##################
session_start();
ob_start();
######################
##### ФИЛЬТРАЦИИ #####
######################
function text($m){
    
$m htmlspecialchars($m);
    
$m mysql_escape_string($m);
    
$m trim($m);
    return 
$m;
/* Фильтрует текст */
function num($m){
    
$m intval($m);
    
$m abs($m);
    return 
$m;
/* Фильтрует цифры */
################
##### КУКИ #####
################
if (isset($_COOKIE['login']) and isset($_COOKIE['password'])) {
    
$login text($_COOKIE['login']);
    
$password text($_COOKIE['password']);

    
$dbs mysql_query("SELECT * FROM `users` WHERE `login` = '".$login."' and `password` = '".$password."' LIMIT 1");
    
$user mysql_fetch_assoc($dbs);

    if (isset(
$user['id'])) {
        if (
$user['login'] != $login or $user['password'] != $password) {
            
setcookie('login'''time() - 86400*31);
            
setcookie('password'''time() - 86400*31);
        }
    }

    
$users mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `login` = '".$login."' and `password`='".$password."' LIMIT 1"));

    if(isset(
$user['id']) && $users['login']!=$login or $users['password']!=$password) {
        
setcookie('login'''time() - 86400*31);
        
setcookie('password'''time() - 86400*31);
    }
}
if (isset(
$_COOKIE['uid']) && isset($_COOKIE['is_soc_key'])){
$is_uid num($_COOKIE['uid']);
$is_soc_key text($_COOKIE['is_soc_key']);

$user mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$is_uid."' AND `is_soc_key` = '".(md5($is_soc_key))."' "));
if(
$user == null){
    
setcookie('uid'''time()+86400*365'/');
    
setcookie('is_soc_key'''time()+86400*365'/');
}

}

$auction 0;
$myLogin $user['login'];
$myID $user['id'];
$__str round($user['str']/6);
$___str round($user['str']/4);
$_str rand($__str$___str);
$__def round($user['def']/12);
$___def round($user['def']/7);
$_def rand($__def$___def);
if(
$user['health'] < 0)$user['health'] = 0;
if(
$user['energy'] < 0)$user['energy'] = 0;
define('H'$_SERVER['DOCUMENT_ROOT']);
require_once 
H.'/system/effects.php';
require_once 
H.'/system/duel.php';
require_once 
H.'/system/gold.php';
require_once 
H.'/system/limit_clan_kazna.php';
require_once 
H.'/system/MySQL_Zapros.php';
###########################
##### Инергия и Жизнь #####
###########################
$be mysql_fetch_array(mysql_query("SELECT * FROM hp_mp WHERE id_user = '".$user['id']."' LIMIT 1"));
if(
$be['id_user'] != $user['id']){
mysql_query("UPDATE users SET health = '".num($user[max_health])."', energy = '$user[max_energy]' WHERE id = '".$user['id']."' LIMIT 1");
mysql_query("INSERT INTO `hp_mp` SET `id_user` = '$user[id]', `last` = '".time()."'");
}else{
$k_point intval((time()-$be['last'])/10);
if(
$effect_4[on] == 1)$k_point intval((time()-$be['last'])/5);
if(
$k_point >= && isset($user)){
$hp $user['health']+(3*$k_point);
$mp $user['energy']+(1*$k_point);
mysql_query("UPDATE users SET health = '$hp', energy = '$mp' WHERE id = '".$user['id']."' LIMIT 1");
mysql_query("UPDATE hp_mp SET last = '".time()."' WHERE id_user = '$user[id]' LIMIT 1");
}
}
if(
$user['health'] > num($user['max_health']))$user['health'] = num($user['max_health']);
if(
$user['energy'] > $user['max_energy'])$user['energy'] = $user['max_energy'];
mysql_query("update `users` set `online` = '".time()."', `ip` = '".$_SERVER['REMOTE_ADDR']."' where (`id` = '".$myID."')");
###################
##### ФУНКЦИИ #####
###################
function exp_koll($exp){
global 
$user;
global 
$auction;
$koll mysql_num_rows(mysql_query("SELECT * FROM `bashna`"));
$good mysql_num_rows(mysql_query("SELECT * FROM `bashna` WHERE `side` = 'good'"));
$evil mysql_num_rows(mysql_query("SELECT * FROM `bashna` WHERE `side` = 'evil'"));
if(
$user['side'] == 'good'){
$my $good;
}else{
$my $evil;
}
$domination round($my/$koll*100);
if(
$domination 50){
$exp $exp+ceil($exp*35/100);
}
if(
$domination == 50){
$exp == $exp+ceil($exp*25/100);
}
return 
$exp;
}
function 
rez_text$text$maxwords 40$maxchar 45 ){
$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.$sep2;
}
function 
icons_user($user){
    
$user mysql_query("SELECT * FROM `users` WHERE `id` = '".$user."' LIMIT 1");
    
$user mysql_fetch_assoc($user);
if(
$user['online'] > time()-300){
$image "<img src='/images/icons/".($user['sex'] == 'w' 'w' '')."$user[side].png' width='15px'>";
}else{
$image "<img src='/images/icons/".($user['sex'] == 'w' 'w' '')."$user[side].png' style='opacity: 0.3;' width='15px'>";
}
return 
$image;
}
function 
text_msg($msg){
$bbcode=array();
$bbcode['/n/isU']='<br>';
global 
$ank;
if(
$ank['access'] >= 0){
$bbcode['/[url=(.+)](.+)[/url]/isU'] = "<a href='$1'>$2</a>";
}
if(
$ank['access'] >= 0){
$bbcode['/[img=(.*)](.*)[/img]/isU'] = "<img src='$1'/>";
}
if(
$ank['access'] >= 0){
$bbcode['/[center](.+)[/center]/isU'] = '<center>$1</center>';
}
if(
$ank['access'] >= 0){
$bbcode['/[u](.+)[/u]/isU'] = '<u>$1</u>';
}
if(
$ank['access'] >= 0){
$bbcode['/[i](.+)[/i]/isU'] = '<i>$1</i>';
}
if(
$ank['access'] >= 0){
$bbcode['/[b](.+)[/b]/isU'] = '<b>$1</b>';
}
if(
$ank['access'] >= 0){
$bbcode['/[url=(.+)](.+)[/url]/isU'] = "<a href='$1'>$2</a>";
}
if(
$ank['access'] >= 0){
$bbcode['/[q](.+)[/q]/isU'] = "<q>$1</q>";
}
if(
$ank['access'] >= 0){
$bbcode['/[a](.+)[/a]/isU'] = "<a>$1</a>";
}
if(
$ank['access'] >= 0){
$bbcode['/[(.+)](.+)[/(.+)]/isU'] = "<font color='$1'>$2</font>";
}
if (
count($bbcode))$msg preg_replace(array_keys($bbcode), array_values($bbcode), $msg);
if(
$ank['access'] == 2)$msg "<span class='item-2'>$msg</span>";
if(
$ank['access'] == 1)$msg "<span class='item-1'>$msg</span>";
if(
$ank['access'] == 0)$msg "<font color='#eacc54'>$msg</font>";

$msg str_replace(array('Гг'), '<img src="/images/smiles/gg.gif" alt="*"/>'$msg);
$msg str_replace(array('*ban*'), '<img src="/images/smiles/ban3.gif" alt="*"/>'$msg);
$msg str_replace(array(':D'), '<img src="/images/smiles/ag.gif" alt="*"/>'$msg);
$msg str_replace(array('.ничоси.'), '<img src="/images/smiles/nichosi.png" alt="*"/>'$msg);
$msg str_replace(array(':ded'), '<img src="/images/smiles/mini_ded.gif" alt="*"/>'$msg);
$msg str_replace(array('O:-)'), '<img src="/images/smiles/mini_angel.gif" alt="*"/>'$msg);
$msg str_replace(array(']:-)'), '<img src="/images/smiles/mini_diablo.gif" alt="*"/>'$msg);
$msg str_replace(array(':$'), '<img src="/images/smiles/mini_blush.gif" alt="*"/>'$msg);
$msg str_replace(array(':)'), '<img src="/images/smiles/mini_lol.gif" alt="*"/>'$msg);
$msg str_replace(array('_wearose_'), '<img src="/images/smiles/mini_rose.gif" alt="*"/>'$msg);
$msg str_replace(array(']:-)'), '<img src="/images/smiles/mini_diablo.gif" alt="*"/>'$msg);
$msg str_replace(array('_ochkonavt_'), '<img src="/images/smiles/mini_palki.gif" alt="*"/>'$msg);
$msg str_replace(array('_hyi_'), '<img src="/images/smiles/mini_fig.gif" alt="*"/>'$msg);
$msg str_replace(array('_love_'), '<img src="/images/smiles/mini_heart.gif" alt="*"/>'$msg);
// Определяем слава которые нарушают правила
$msg str_replace(array('блять','соси','дибил','еблан','нахуй','ебан','хуй','бля','гавно','хрень','мудак','пидор','чмо','aux','пизда','пабл'), '<font color="red">мат</font>'$msg);
return 
$msg;
}
function 
msg($sms){
echo 
'<div class="bntf"><div class="nl"><div class="nr cntr lyell lh1 p5 sh"><b><h2> '.$sms.' </h2></b></div></div></div><div class="stone"></div>';
}
function 
ico($dir,$file){
    
$img '<img src="/images/'.$dir.'/'.$file.'" width="15px" alt="*" />';
    return 
$img;
}
function 
img($dir,$file){
    
$img '<img src="/images/'.$dir.'/'.$file.'" alt="*" />';
    return 
$img;
}
function 
tl($tl){
    
$d=3600*24;
    
$day=floor($tl/$d);
    
$tl=$tl-($d*$day);

    
$hour=floor($tl/3600);
    
$tl=$tl-(3600*$hour);

    
$minute=floor($tl/60);
    
$tl=$tl-(60*$minute);

    
$second=floor($tl);

    
$dayt="".($day>0?"$day д. ":null)."";
    
$hourt="".($hour>0?"$hour ч. ":null)."";
    
$minutet="".($minute>0?"$minute м. ":null)."";
    
$secondt="".($second>0?"$second с. ":null)."";

    if(
$day>0){
        
$minutet=NULL;
        
$secondt=NULL;
    }
    if(
$hour>&& $day==0){
        
$secondt=NULL;
        
$dayt=NULL;
    }

    return 
"$dayt$hourt$minutet$secondt";
/* Вывод оставшегося времени */

function vremja($time=NULL){
    if (
$time == NULL)$time time();
    
$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 (
$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 noauth(){
    global 
$user;
    if(isset(
$user['id'])) header('Location: /main');
}

function 
auth(){
    global 
$user;
    if(!isset(
$user['id'])) header('Location: /');
}

function 
access($access 0){
    global 
$user;
    if(
$user['access'] < $accessheader('Location: /main');
}

function 
page($k_page=1){ // Выдает текущую страницу
$page=1;
if (isset(
$_GET['page'])){
if (
$_GET['page']=='end')$page=intval($k_page);elseif(is_numeric($_GET['page'])) $page=intval($_GET['page']);}
if (
$page<1)$page=1;
if (
$page>$k_page)$page=$k_page;
return 
$page;}

function 
k_page($k_post=0,$k_p_str=10){ // Высчитывает количество страниц
if ($k_post!=0){$v_pages=ceil($k_post/$k_p_str);return $v_pages;}
else return 
1;}

function 
str($link='?',$k_page=1,$page=1){ // Вывод номеров страниц (только на первый взгляд кажется сложно ;))
if ($page<1)$page=1;
echo 
"<div class="str">n";
if (
$page!=1)echo "<span class='pag'><a href="".$link."page=".($page-1)."" title='Предыдущая страница (№".($page-1).")'>Назад</a></span> ";else echo "<span class='white'>Назад</span>";
echo 
" | ";
if (
$page!=$k_page)echo " <span class='pag'><a href="".$link."page=".($page+1)."" title='Следующая страница (№".($page+1).")'>Вперёд</a></span>";else echo "<span class='white'>Вперёд</span>";
echo 
"<br />n";
if (
$page!=1)echo "<span class='pag'><a href="".$link."page=1" title='Первая страница'>&lt;&lt;</a></span> ";
if (
$page!=1)echo "<span class='pag'><a href="".$link."page=1" title='Страница №1'>1</a></span>";else echo "<span class='white'>1</span>";
for (
$ot=-3$ot<=3$ot++){
if (
$page+$ot>&& $page+$ot<$k_page){
if (
$ot==-&& $page+$ot>2)echo "  ..";
if (
$ot!=0)echo " <span class='pag'><a href="".$link."page=".($page+$ot)."" title='Страница №".($page+$ot)."'>".($page+$ot)."</a></span>";else echo " <span class='white'> ".($page+$ot)."</span>";
if (
$ot==&& $page+$ot<$k_page-1)echo " ..";}}
if (
$page!=$k_page)echo " <span class='pag'><a href="".$link."page=end" title='Страница №$k_page'>$k_page</a></span>";elseif ($k_page>1)echo " <span class='white'>$k_page</span>";
if (
$page!=$k_page)echo " <span class='pag'><a href="".$link."page=end" title='Последняя страница'> &gt;&gt;</a></span>";

echo 
"</div>n";
}
function 
n_f($i$tip 0) {

if(
$tip == 1){

$i number_format($i0''''');
}else{

    if($i >= 10000 && $i < 1000000) {

      $i = number_format($i, 0, '', '
.');

      $i = round($i,1).'
K';

    }
elseif($i >= 1000000) {

      $i = number_format($i, 0, '', '
.');

      $i = round($i,1).'
M';

    }
    else
    {

      $i = number_format($i, 0, '', '''
);

    }
    }
    return 
$i;

    }
function 
skill($skill){
switch(
$skill){
case 
0:
$class 0;
break;
case 
1:
$class 1;
break;
case 
10:
$class 2;
break;
case 
26:
$class 3;
break;
case 
48:
$class 4;
break;
case 
100:
$class 5;
break;
}
return 
$class;
}
$random rand(4999,6999);



/* -- функции by InstalScript-- */

if($user['login'] == 'XaKeRoK'){
ini_set('display_errors''On');
error_reporting(E_WARNING);
echo 
"
<style>
body{
color:white;
}
</style>
"
;
}
if(
$user['login'] == 'Злобный Я'){
ini_set('display_errors''On');
error_reporting(E_WARNING);
echo 
"
<style>
body{
color:white;
}
</style>
"
;
}
function 
user($uid,$colon){
$user mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".num($uid)."' "));
return 
$user[$colon];
}
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 
isTimer($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 
isLogin($uid,$n){
$vip explode("/",(user($uid,'is_vip')));
$nick user($uid,'login');
if(
$vip['0'] == '1'){

if(
$vip['1'] < time()){
mysql_query("UPDATE `users` SET `vip` = '0/0/0/0' WHERE `id` = '".($uid)."'  ");
}

$nick "".user($uid,'login')."<img src = '/images/icons/vip_icon.png'>";
}
return 
$nick;
}

function 
isUnotification($uid,$idu,$text,$did,$type,$page){
$uid num($uid); // id игрока (кто получит)
$idu num($idu); // id игрока (кто отправил)
$did num($did); // id - дополнительный
$text text($text); // Сообщение
$type text($type); // Тип (место от куда оправленно)
$page num($page); // номер страницы (с которой отправили)

$opponent mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".($uid)."' "));
if(
$opponent != null && $uid != $idu){
mysql_query("INSERT INTO `is_time` SET `text` = '".$text."',`uid` = '".$uid."',`idu` = '".$idu."',`did` = '".($did)."',`type` = '".$type."',`type2` = 'notification',`time` = '".(time())."' ");
}
}
function 
isUnotificationAct($uid){
$uid num($uid);
$not mysql_result(mysql_query("SELECT COUNT(*) FROM `is_time` WHERE `type2` = 'notification' AND `uid` = '".$uid."' "),0);
if(
$not 0){
echo 
"<div class = 'block'>";
$notif mysql_query("SELECT * FROM `is_time` WHERE `type2` = 'notification' AND `uid` = '".$uid."' ");
while(
$n mysql_fetch_assoc($notif)){
$isLogin = (isLogin($n['idu'],''));
echo 
"
<div class = 'isLogin'>"
.$isLogin."</div>ответил".(user($n['idu'],'sex') == 'w' "а" "")." вам
<div class = 'isNotifMsg'>"
.$n['text']."</div>";
if(
$n['type'] == 'chat'){
$chat mysql_result(mysql_query("SELECT COUNT(*) FROM `chat` WHERE `id` >= '".$n['did']."' "),0);
$page ceil($chat/10);
if(
$_GET['notification'] == $n['id']){
if(
$chat == '0'){
$_SESSION['msg'] = "Сообщение не найдено! Возможно оно удалено!";
}
else{
$lnk "?page=".$page."&#message".$n['did']."";
mysql_query("DELETE FROM `is_time` WHERE `id` = '".num($_GET['notification'])."' ");
}
header("Location:/chat".$lnk."");
exit();
}
echo 
"<a href = '/main?notification=".$n['id']."'>Перейти к сообщению</a>";
}


}
echo 
"</div>";
}
}


$my_ban mysql_fetch_assoc(mysql_query("SELECT * FROM `ban` WHERE `id_user` = '".$user['id']."' "));
if(
$my_ban != null && $_SERVER['REQUEST_URI'] != '/uban'){
header("Location:/uban");
exit();
}
if(!empty(
$user['vip'])){
$vip explode("/",(user($user['id'],'is_vip')));
if(
$vip['1'] <= time()){
mysql_query("UPDATE `users` SET `is_vip` = '' WHERE `id` = '".($user['id'])."' ");
}
if(
$vip['2'] < $user['exp'] or $vip['3'] < $user['crystals']){
$n_exp = ($user['exp'] - $vip['2']) * 2;
$n_crystals = ($user['crystals'] - $vip['3']) * 2;

$u_exp = (($user['exp'] - $vip['2']) * 2);
$u_crystals = (($user['crystals'] - $vip['3']) * 2);
$u_exp $user['exp'] + $u_exp 3;
$u_crystals $user['crystals'] + $u_crystals 3;

mysql_query("UPDATE `users` SET `exp` = '".$u_exp."',`crystals` = '".$u_crystals."',`is_vip` = '".$vip['0']."/".$vip['1']."/".$u_exp."/".$u_crystals."' WHERE `id` = '".$user['id']."' ");
}
if(
$user['crystals'] < $vip['3']){
mysql_query("UPDATE `users` SET `is_vip` = '".$vip['0']."/".$vip['1']."/".$vip['2']."/".$user['crystals']."' WHERE `id` = '".$user['id']."' ");
}


}
/* -- -- -- -- -- -- -- -- -- -- -- -- -- --*/



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