Регистрация Главная Пользователи Все разделы прочитаны
Сообщения за день Справка Регистрация
Навигация
Zhyk.org LIVE! Реклама на Zhyk.org Правила Форума Награды и достижения Доска "почета"

Ответ
 
Опции темы
Старый 06.04.2014, 10:07   #1
Заблокирован
 Сержант
Аватар для Alp€rium
 
Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(Alp€rium сломал счётчик популярности :(
Регистрация: 11.11.2011
Сообщений: 98
Популярность: 33905
Золото Zhyk.Ru: 70
Сказал(а) спасибо: 792
Поблагодарили 342 раз(а) в 205 сообщениях
Отправить сообщение для Alp€rium с помощью ICQ Отправить сообщение для Alp€rium с помощью Skype™
 
По умолчанию Вывод админов SourceBans ссылками на HLstatsX CE

Добавлена возможность пдрубатся к двум базам на разных адресах(хостах)!

Скрипт вывода администрации, пример можно посмотреть по ссылкам (не реклама)
1. [Ссылки могут видеть только зарегистрированные пользователи. ] (Скилет)
2. [Ссылки могут видеть только зарегистрированные пользователи. ] (в шаблоне)

Что задействовано
JS/CSS - Twitter Bootstrap v2.3.1
jQuery v1.9.1

Настройка
Все настройки прописываем в файле config.php
$hlx_webpage - Адрес сайта HLstatsX CE
$sb_webpage - Адрес сайтеа SourceBans


Подлключаемя к HLstatsX CE
PHP код:
$opts_hlx = array(
    
'host'     => '10.1.1.54',         /*Адрес*/
    
'user'    => 'endi',             /* Имя пользователя */
    
'pass'    => '*********',     /* Пароль */
    
'db'      => 'game',             /* Имя базы */
); 
Подлключаемя к SourceBans
PHP код:
$opts_bans = array(
    
'host'     => '10.25.0.146',     /*Адрес*/
    
'user'    => 'vectorserver',             /* Имя пользователя */
    
'pass'    => '*********',     /* Пароль */
    
'db'      => 'bans',             /* Имя базы */
); 
Вывод определенных модов игр (Напимер только CSS и HL2)
Открываем файл index.html
Ишем в тегах ********** data.php дописываем параметр game
Пример: data.php?game=css
Код:
<script type="text/javascript">
	jQuery(function(){
			jQuery("#loadpage").fadeOut(200).load("data.php?game=css,hl2").fadeIn(800);
		});
</script>
Также можно перечесть типы игр через запятую.
Пример: data.php?game=css,cs,hl,tf


Файлы
index.html
PHP код:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <
meta name="keywords" content="minecraft,warsow,cs:s,cs16,сервер,convex,crfxfnm,xbns,tagil,portal,cominet,vector,endi,bans,статистика,баны,игры,тагил,лучший,скачать,no-steam,379-379,online" />
  <
meta name="description" content="Мы рады приветствовать вас на игровом портале game.cominet.ru 
 Наш игровой портал создан в первую очередь для тех, кто любит популярные on-line игры. Сервера game.cominet.ru открыты для всех желающих и работают круглосуточно.  Постоянно доступен мониторинг игровых серверов.Все вопросы можно задать и найти нужный ответ по теме  на форуме ." 
/>
<
title>Вывод администрации game.cominet.ru</title>
<
script src="http://yandex.st/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
    jQuery.noConflict();
</script>
<link rel="stylesheet" href="http://yandex.st/bootstrap/2.3.1/css/bootstrap.min.css">
<script src="http://yandex.st/bootstrap/2.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://yandex.st/jquery-ui/1.10.2/themes/black-tie/jquery-ui.min.css">
<script src="http://yandex.st/jquery-ui/1.10.2/jquery-ui.min.js"></script>

<script type="text/javascript">
    jQuery(function(){
            jQuery("#loadpage").fadeOut(200).load("data.php").fadeIn(800);
        });
</script>


</head>

<body data-spy="scroll" data-target=".bs-docs-sidebar">
<div class="containere">
<div id="loadpage">Загрузка...</div>
</div>
</body>
</html> 
config.php
PHP код:
<?php
/* Адрес сайта Статистики */
$hlx_webpage "http://game.cominet.ru/stats/";
/* Адрес сайтеа СБ */
$sb_webpage "http://game.cominet.ru/bans/";

include_once(
'safemysql.class.php');
/* Подлключаемя к статистике */
$opts_hlx = array(
    
'host'     => '10.1.1.54',         /*Адрес*/
    
'user'    => 'endi',             /* Имя пользователя */
    
'pass'    => '*********',     /* Пароль */
    
'db'      => 'game',             /* Имя базы */
);

$db_hlx = new SafeMySQL($opts_hlx);
/* //////////////////////////////////////////////////// */


/* Подлключаемя к банлисту */
$opts_bans = array(
    
'host'     => '10.25.0.146',     /*Адрес*/
    
'user'    => 'vectorserver',             /* Имя пользователя */
    
'pass'    => '*********',     /* Пароль */
    
'db'      => 'bans',             /* Имя базы */
);

$db_bans = new SafeMySQL($opts_bans);
/* //////////////////////////////////////////////////// */
?>
data.php
PHP код:
<?php
include('config.php');

$check = ($db_bans && $db_hlx)? true : die('error DB!');

if(
$check){
    
$i 1;
    
$tag     explode(",",@$_GET['game']);
    
$g_tag     = (empty($tag)|| $tag[0]) ? "u.game in('".implode("','",$tag)."') AND" "";
    
$db     $db_bans->getAll("SELECT * FROM sb_admins AS a WHERE a.authid != 'STEAM_ID_SERVER'");
        function 
st32to64($m1,$m2){
            list(
$steam_cid, ) = explode('.'bcadd((((int) $m2 2) + $m1), '76561197960265728'), 2);
            return 
$steam_cid;
        }
        
        function 
rusdate($d$format 'j %MONTH% Y'$offset 0)
        {
            
$montharr = array('Января''Февраля''Марта''Апреля''Мая''Июня''Июля''Августа''Сентября''Октября''Ноября''Декабря');
            
$dayarr = array('Пн''Вт''Ср''Чт''Пт''Сб''Вс');
         
            
$d += 3600 $offset;
         
            
$sarr = array('/%MONTH%/i''/%DAYWEEK%/i');
            
$rarr = array( $montharr[date("m"$d) - 1], $dayarr[date("N"$d) - 1] );
         
            
$format preg_replace($sarr$rarr$format); 
            return 
date($format$d);
        }
    
    
    
$html "<table class=\"table table-bordered table-striped\">";
    
$html.= "<thead>";
    
$html.= "<tr>";
    
$html.= "<th>#</th>";
    
$html.= "<th><i class=\"icon-user\"></i>  Псевдоним / Ник / Кол-во. банов</th>";
    
$html.= "<th><i class=\"icon-time\"></i> Посл. визит</th>";
    
$html.= "<th><i class=\"icon-globe\"></i>  SteamID</th>";
    
$html.= "<th><i class=\"icon-envelope\"></i>  Email</th>";
    
$html.= "</tr>";
    
$html.= "</thead>";
    
$html.= "<tbody>";
    foreach(
$db as $k){
        
$sb_user     $k['user'];
        
$sb_aid        $k['aid'];
        
$sb_authid     explode(':'$k['authid'], 3);
        
$sb_email     $k['email'];
        
$hlx         $db_hlx->getRow("SELECT * FROM hlstats_Players AS p INNER JOIN hlstats_PlayerUniqueIds AS u ON u.playerId = p.playerId WHERE {$g_tag} u.uniqueId = '{$sb_authid[1]}:{$sb_authid[2]}' LIMIT 0, 1");
        
        if(
$hlx != NULL){
            
$countbans $db_bans->getRow("SELECT COUNT(*) as c FROM sb_bans WHERE aid = '{$sb_aid}'");
        
        
            if(
$hlx['email']==NULL && $hlx['email'] != $sb_email){
                
$db_hlx->query("UPDATE `hlstats_Players` SET `email`='{$sb_email}' WHERE (`playerId`='{$hlx['playerId']}')");
            }
            
            
$lasevent rusdate$hlx['last_event'], '%DAYWEEK%, j %MONTH% Y, G:i' );
            
$steam64 st32to64($sb_authid[1],$sb_authid[2]);
            
$html.="<tr>";
            
$html.="<td>".$i++."</td>";
            
$html.="<td><a title=\"Переход к статистике админа: {$hlx['lastName']}\" target=\"_blank\" href=\"{$hlx_webpage}hlstats.php?mode=playerinfo&game={$tag[0]}&player={$hlx['playerId']}\"\">{$hlx['lastName']}</a> <small>($sb_user)</small>".
                    
" <a title=\"Посмотреть все баны админа: {$hlx['lastName']}\" target=\"_blank\" href=\"{$sb_webpage}index.php?p=banlist&advSearch={$sb_aid}&advType=admin\"><i class=\"icon-th-list\"></i> ({$countbans['c']})</a></td>";
            
$html.="<td>{$lasevent}</td>";
            
$html.="<td><a title=\"Переход в профиль steamcommunity.com\" target=\"_blank\" href=\"http://steamcommunity.com/profiles/{$steam64}/\">STEAM_{$hlx['uniqueId']}</a></td>";
            
$html.="<td><a title=\"Написать письмо админу!\" target=\"_blank\" href=\"mailto:{$sb_email}\">{$sb_email}</a></td>";
            
$html.="</tr>";
            
            
        }
    }
    
$html.= "</tbody>";;
    
$html.= "</table>";
    echo 
$html;
    
}
?>
safemysql.class.php [Ссылки могут видеть только зарегистрированные пользователи. ]
PHP код:
<?php
class SafeMySQL
{

    private 
$conn;
    private 
$stats;
    private 
$emode;
    private 
$exname;

    private 
$defaults = array(
        
'host'      => 'localhost',
        
'user'      => 'root',
        
'pass'      => '',
        
'db'        => 'test',
        
'port'      => NULL,
        
'socket'    => NULL,
        
'pconnect'  => FALSE,
        
'charset'   => 'utf8',
        
'errmode'   => 'error'//or exception
        
'exception' => 'Exception'//Exception class name
    
);

    const 
RESULT_ASSOC MYSQLI_ASSOC;
    const 
RESULT_NUM   MYSQLI_NUM;

    function 
__construct($opt = array())
    {
        
$opt array_merge($this->defaults,$opt);

        
$this->emode  $opt['errmode'];
        
$this->exname $opt['exception'];

        if (
$opt['pconnect'])
        {
            
$opt['host'] = "p:".$opt['host'];
        }

        @
$this->conn mysqli_connect($opt['host'], $opt['user'], $opt['pass'], $opt['db'], $opt['port'], $opt['socket']);
        if ( !
$this->conn )
        {
            
$this->error(mysqli_connect_errno()." ".mysqli_connect_error());
        }

        
mysqli_set_charset($this->conn$opt['charset']) or $this->error(mysqli_error($this->conn));
        unset(
$opt); // I am paranoid
    
}

    public function 
query()
    {    
        return 
$this->rawQuery($this->prepareQuery(func_get_args()));
    }

    public function 
fetch($result,$mode=self::RESULT_ASSOC)
    {
        return 
mysqli_fetch_array($result$mode);
    }


    public function 
affectedRows()
    {
        return 
mysqli_affected_rows ($this->conn);
    }

    public function 
insertId()
    {
        return 
mysqli_insert_id($this->conn);
    }

    public function 
numRows($result)
    {
        return 
mysqli_num_rows($result);
    }

    public function 
free($result)
    {
        
mysqli_free_result($result);
    }

    public function 
getOne()
    {
        
$query $this->prepareQuery(func_get_args());
        if (
$res $this->rawQuery($query))
        {
            
$row $this->fetch($res);
            if (
is_array($row)) {
                return 
reset($row);
            }
            
$this->free($res);
        }
        return 
FALSE;
    }

    public function 
getRow()
    {
        
$query $this->prepareQuery(func_get_args());
        if (
$res $this->rawQuery($query)) {
            
$ret $this->fetch($res);
            
$this->free($res);
            return 
$ret;
        }
        return 
FALSE;
    }

    public function 
getCol()
    {
        
$ret   = array();
        
$query $this->prepareQuery(func_get_args());
        if ( 
$res $this->rawQuery($query) )
        {
            while(
$row $this->fetch($res))
            {
                
$ret[] = reset($row);
            }
            
$this->free($res);
        }
        return 
$ret;
    }

    public function 
getAll()
    {
        
$ret   = array();
        
$query $this->prepareQuery(func_get_args());
        if ( 
$res $this->rawQuery($query) )
        {
            while(
$row $this->fetch($res))
            {
                
$ret[] = $row;
            }
            
$this->free($res);
        }
        return 
$ret;
    }

    public function 
getInd()
    {
        
$args  func_get_args();
        
$index array_shift($args);
        
$query $this->prepareQuery($args);

        
$ret = array();
        if ( 
$res $this->rawQuery($query) )
        {
            while(
$row $this->fetch($res))
            {
                
$ret[$row[$index]] = $row;
            }
            
$this->free($res);
        }
        return 
$ret;
    }

    public function 
getIndCol()
    {
        
$args  func_get_args();
        
$index array_shift($args);
        
$query $this->prepareQuery($args);

        
$ret = array();
        if ( 
$res $this->rawQuery($query) )
        {
            while(
$row $this->fetch($res))
            {
                
$key $row[$index];
                unset(
$row[$index]);
                
$ret[$key] = reset($row);
            }
            
$this->free($res);
        }
        return 
$ret;
    }

    public function 
parse()
    {
        return 
$this->prepareQuery(func_get_args());
    }

    public function 
whiteList($input,$allowed,$default=FALSE)
    {
        
$found array_search($input,$allowed);
        return (
$found === FALSE) ? $default $allowed[$found];
    }

    public function 
filterArray($input,$allowed)
    {
        foreach(
array_keys($input) as $key )
        {
            if ( !
in_array($key,$allowed) )
            {
                unset(
$input[$key]);
            }
        }
        return 
$input;
    }

    public function 
lastQuery()
    {
        
$last end($this->stats);
        return 
$last['query'];
    }

    public function 
getStats()
    {
        return 
$this->stats;
    }

    private function 
rawQuery($query)
    {
        
$start microtime(TRUE);
        
$res   mysqli_query($this->conn$query);
        
$timer microtime(TRUE) - $start;

        
$this->stats[] = array(
            
'query' => $query,
            
'start' => $start,
            
'timer' => $timer,
        );
        if (!
$res)
        {
            
$error mysqli_error($this->conn);
            
            
end($this->stats);
            
$key key($this->stats);
            
$this->stats[$key]['error'] = $error;
            
$this->cutStats();
            
            
$this->error("$error. Full query: [$query]");
        }
        
$this->cutStats();
        return 
$res;
    }

    private function 
prepareQuery($args)
    {
        
$query '';
        
$raw   array_shift($args);
        
$array preg_split('~(\?[nsiuap])~u',$raw,null,PREG_SPLIT_DELIM_CAPTURE);
        
$anum  count($args);
        
$pnum  floor(count($array) / 2);
        if ( 
$pnum != $anum )
        {
            
$this->error("Number of args ($anum) doesn't match number of placeholders ($pnum) in [$raw]");
        }

        foreach (
$array as $i => $part)
        {
            if ( (
$i 2) == )
            {
                
$query .= $part;
                continue;
            }

            
$value array_shift($args);
            switch (
$part)
            {
                case 
'?n':
                    
$part $this->escapeIdent($value);
                    break;
                case 
'?s':
                    
$part $this->escapeString($value);
                    break;
                case 
'?i':
                    
$part $this->escapeInt($value);
                    break;
                case 
'?a':
                    
$part $this->createIN($value);
                    break;
                case 
'?u':
                    
$part $this->createSET($value);
                    break;
                case 
'?p':
                    
$part $value;
                    break;
            }
            
$query .= $part;
        }
        return 
$query;
    }

    private function 
escapeInt($value)
    {
        if (
$value === NULL)
        {
            return 
'NULL';
        }
        if(!
is_numeric($value))
        {
            
$this->error("Integer (?i) placeholder expects numeric value, ".gettype($value)." given");
            return 
FALSE;
        }
        if (
is_float($value))
        {
            
$value number_format($value0'.'''); // may lose precision on big numbers
        

        return 
$value;
    }

    private function 
escapeString($value)
    {
        if (
$value === NULL)
        {
            return 
'NULL';
        }
        return    
"'".mysqli_real_escape_string($this->conn,$value)."'";
    }

    private function 
escapeIdent($value)
    {
        if (
$value)
        {
            return 
"`".str_replace("`","``",$value)."`";
        } else {
            
$this->error("Empty value for identifier (?n) placeholder");
        }
    }

    private function 
createIN($data)
    {
        if (!
is_array($data))
        {
            
$this->error("Value for IN (?a) placeholder should be array");
            return;
        }
        if (!
$data)
        {
            return 
'NULL';
        }
        
$query $comma '';
        foreach (
$data as $value)
        {
            
$query .= $comma.$this->escapeString($value);
            
$comma  ",";
        }
        return 
$query;
    }

    private function 
createSET($data)
    {
        if (!
is_array($data))
        {
            
$this->error("SET (?u) placeholder expects array, ".gettype($data)." given");
            return;
        }
        if (!
$data)
        {
            
$this->error("Empty array for SET (?u) placeholder");
            return;
        }
        
$query $comma '';
        foreach (
$data as $key => $value)
        {
            
$query .= $comma.$this->escapeIdent($key).'='.$this->escapeString($value);
            
$comma  ",";
        }
        return 
$query;
    }

    private function 
error($err)
    {
        
$err  __CLASS__.": ".$err;

        if ( 
$this->emode == 'error' )
        {
            
$err .= ". Error initiated in ".$this->caller().", thrown";
            
trigger_error($err,E_USER_ERROR);
        } else {
            throw new 
$this->exname($err);
        }
    }

    private function 
caller()
    {
        
$trace  debug_backtrace();
        
$caller '';
        foreach (
$trace as $t)
        {
            if ( isset(
$t['class']) && $t['class'] == __CLASS__ )
            {
                
$caller $t['file']." on line ".$t['line'];
            } else {
                break;
            }
        }
        return 
$caller;
    }

    private function 
cutStats()
    {
        if ( 
count($this->stats) > 100 )
        {
            
reset($this->stats);
            
$first key($this->stats);
            unset(
$this->stats[$first]);
        }
    }
}
[Ссылки могут видеть только зарегистрированные пользователи. ]
[Ссылки могут видеть только зарегистрированные пользователи. ]
  Ответить с цитированием
Ответ

Опции темы

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход

Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
[Услуги] Вывод ЯД без пп,покупка,разблокировка кошельков. Вывод средств с WM MedvedRussia Товары/услуги в Сети 88 08.03.2014 17:56
[Помогите!] Помогите с ссылками readln Вопросы и ответы, обсуждения 5 18.11.2012 18:12
[Скрипт] SourceBans 1.4.6 Novichok Web-программирование и технологии 0 12.04.2010 18:27

Заявление об ответственности / Список мошенников

Часовой пояс GMT +4, время: 02:45.

Пишите нам: [email protected]
Copyright © 2024 vBulletin Solutions, Inc.
Translate: zCarot. Webdesign by DevArt (Fox)
G-gaMe! Team production | Since 2008
Hosted by GShost.net