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

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

  1. root

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

    Регистрация:
    23 авг 2014
    Сообщения:
    253
    Симпатии:
    56
    Баллы:
    11
    Код:
    <?php  DEFINE("SELECT_ONLINE","select count(*) from user_data where  account_id>0 and online=1");  
    
    
    function connectdb($db, $dbaddress, $dbuser, $dbpass){  
    $dbconnect = mssql_connect ($dbaddress, $dbuser, $dbpass);  
      mssql_select_db ($db, $dbconnect);  
      }  
        
    connectdb('lin2world', '172.16.192.34', 'sawa', 'dfsdfFdvh');  
    $result = mssql_query(sprintf(SELECT_ONLINE));  
    $accounts = mssql_fetch_array($result);  
    $accounts = trim($accounts[0]);  
    
    
    
    
    send_announce("Now online: ".$accounts." users");  
    
    
    exit;  
    
    
    
    
    function send_announce($announce){  
    $buf=pack("c",70).tounicode($announce);  
    [email protected]("172.16.192.3","2012",$errno,$errstr,1) or die($notconnected);  
    fwrite($cachedsocket,pack("s",(strlen($buf)+2)).$buf);  
    $len=unpack("v",fread($cachedsocket,2));  
    $rid=unpack("c",fread($cachedsocket,1));  
      for($i=0;$i<(($len[1]-4)/4);$i++){  
        $read=unpack("i",fread($cachedsocket,4));  
          $rs.=$read[1];  
           }  
           fclose($cachedsocket);  
    }  
    
    
    
    
    function tounicode($string){  
      $rs="";  
      for($i=0;$i<strlen($string);$i++)  
      $rs.=$string[$i].chr(0);  
      return($rs.chr(0).chr(0));  
    }  
    ?>