[SCRIPT] Онлайн аннонсами

Тема в разделе "Веб скрипты (WEB)", создана пользователем root, 1 окт 2014.

  1. root

    root Administrator Команда форума Administrator Moderator Developers Team

    Регистрация:
    23 авг 2014
    Сообщения:
    254
    Симпатии:
    58
    Баллы:
    11
    Код:
    <?php 
    
    $ip = '172.16.192.3';        // IP game server 
    $port = 7788;            // Port game server 
    $time = 10;              // Time refresh chech online (sec) 
    $cachefile = "/var/www/showmebigtits.com/htdocs/serverstat.txt";    // file cache online 
    
    
    $fp = @fopen($cachefile,"r") or die('File ERROR'); 
    $str_read = fread($fp, filesize($cachefile)); 
    fclose($fp); 
    
    
    list($lasttime, $current, $playing, $store, $max) = explode(":", $str_read); 
    
    
    if (@fsockopen($ip,$port)!==NULL) { 
    
    
    if(($lasttime + $time) < time()) 
    { 
        $fs = @fsockopen($ip,$port) or die('Sock ERROR'); 
        $pck = pack("vCi",6,0,-3); 
        fwrite($fs,$pck); 
        $r=fread($fs,73); 
        fclose($fs); 
        list($size, $id, $world, $max, $current, $playing, $store) = array_values(unpack("vsize/Cid/iworld/imax/icurrent/iplaying/istore",$r)); 
    
    
        $fp = @fopen($cachefile,"w") or die('File ERROR'); 
        fwrite($fp,time().":".$current.":".$playing.":".$store.":".$max); 
        fclose($fp); 
    } 
    } 
    else 
    
    
     $fp = @fopen($cachefile,"w") or die('File ERROR'); 
        fwrite($fp,time().":".0.":".0.":".0.":".0); 
        fclose($fp); 
    echo "SYS: current({$current}), playing({$playing}), private store({$store}), max({$max})\n"; 
    ?>