Jump to content
News ticker
  • Bienvenue sur le nouveau forum VeryGames
  • Welcome to the new VeryGames forum
  • VeryNews

    [Block TS] Hs depuis la maintenance


    Cleaner
     Share

    Recommended Posts

    Loo

     

    Depuis la maintance de Ts le Block Teamspeak de nukeckan ne fonctionne plus

     

    Qui possede la lumiere ?

    <?php
    
    /************************************************************************/
    /* TeamSpeak Block For PHP-NUKE: Web Portal System                      */
    /* ===============================================                      */
    /*                                                                      */
    /* Copyright (c) 2004 by **CloseUp**|Ds|                                */
    /* http://darkknights.dk                                                */
    /* I have only made this script with Cut & Paste from many other scripts*/
    /************************************************************************/
    
    if (eregi("block-TeamSpeak_nuke.php",$_SERVER['PHP_SELF'])) {
       Header("Location: index.php");
       die();
    }
    
    // retrieve server info
    require("TSInfo.php");
    $tss2info		 -> getInfo();
    $tss2info		 -> userName="$username";
    //$serverQueryPort	 = 14534;			 // default 51234, must be accessible and usable. check server.ini 
    $serverQueryPort	 = 49669;			 // default 51234, must be accessible and usable. check server.ini 
    //$serverAddress		 = "82.228.148.81";		 // TeamSpeak IP, don't use localhost here
    $serverAddress		 = "teamspeak-2.verygames.net";	 // TeamSpeak IP, don't use localhost here
    //$serverAddress	 = "$serverURL";		 // TeamSpeak IP, don't use localhost here
    //$serverUDPPort		 = "8767";			 // default 8767
    $serverUDPPort		 = "50669";			 // default 8767
    //$serverUDPPort	 = "8767";			 // default 8767
    
    // Don't edit below unless you know what you are messing with
    $serverAddress2		 = "$serverAddress:$serverUDPPort";
    
    // Get Nuke UserName
    global $user, $cookie, $user_prefix;
    cookiedecode($user);
    $username = $cookie[1];
    	$sql = "SELECT user_id FROM $user_prefix"._users." WHERE username='$username'";
    // display channel list
    $content	 .= "<table aalign=\"center\" width=\"100%\">\n";
    $counter	 = 0;
    foreach($tss2info->channelList as $channelInfo) 
    {
     $channelname = $channelInfo[channelname];
    
     // determine codec (verbose)
     $codec = $tss2info->getVerboseCodec($channelInfo[codec]);
    
     // default?
     if ($channelInfo[isdefault] == "1")  $isDefault = "yes"; else $isDefault = "no";
     if ($channelInfo[channelid] != "id") 
     {
    	 $content	 .= ("<tr><td><img src=\"ts2/images/bullet_channel.gif\" align=absmiddle alt=MAX".$channelInfo[maxplayers]."Players>[i]<a href=\"teamspeak://".$serverAddress.":".$serverUDPPort."/nickname=".$username."?loginname=?password=?channel=".$channelname."?channelpassword=\">".$channelname."</a>[/i]</td></tr>\n");
    	 $counter_player = 0;
    	 foreach($tss2info->playerList as $playerInfo) 
    	 {
    		 if ($playerInfo[channelid] == $channelInfo[channelid]) 
    		 {
    			 $content .=("<tr><td><img src=\"ts2/images/bullet_0.gif\" alt=$playerInfo[playername] align=absmiddle>".$playerInfo[playername]."</td></tr>\n");
    			$counter_player++;
    		 }
    	}
    	if($counter_player == 0) $content .= ("<tr><td></td></tr>\n");
      }
     $counter++;
    }// end foreach
    
    if ($counter == 0) $content .= ("<tr><td colspan=\"7\" align=\"CENTER\">Serveur arrêté !</td></tr>\n");
    
    $content .= ("</table>\n</div>\n");
    
    //Copyright Please don't remove with out my approval
    //$content .= ("");
    ?>
    

    <?php
    
    class tss2info 
    {
     // **** Configuration, A éditer pour permettre de voir les connectés sur TS2 ****
     var $serverURL		 = "teamspeak-2.verygames.net"; // mettez l'adresse ip où ce trouve votre serveur TS2
     var $serverAddress	 = "teamspeak-2.verygames.net"; // adresse IP du serveur TS2
     var $serverQueryPort	 = 49669; // defaut 51234, pour le savoir edité le server.ini
     var $serverUDPPort	 = 50669; // defaut 8767
     // **** Fin de la configuration ****
     //interne
     var $socket;
     // externe
     var $serverStatus	 = "Fermé";
     var $playerList	 = array();
     var $channelList	 = array();
    
    
     // ouvre la connection du serveur TS2
     function getSocket($host, $port, $errno, $errstr, $timeout) 
    {
    	 unset($socket);
    	 $attempts	 = 1;
    	 while($attempts <= 1 and !$socket) 
    	 {
    	 $attempts++;
    	 	 @$socket	 = fsockopen($host, $port, $errno, $errstr, $timeout);
    	 	 $this->errno	 = $errno;
    	 	 $this->errstr	 = $errstr;
    	 	 if($socket and fread($socket, 4) == "[TS]") 
    	 	 {
    	 	 	 fgets($socket, 128);
    	 	 	 return $socket;
    		 }
    	 }// Fin
    	 return false;
    }// Fin de la fonction getSocket(...)
    
     // Envoi du Query au serveur TS2
     function sendQuery($socket, $query)
    {
    	 fputs($socket, $query."\n");
    }// Fin de la	 fonction sendQuery(...)
    
     // Réponse OK ?
     function getOK($socket) 
    {
    	 $result	 = fread($socket, 2);
    	 fgets($socket, 128);
    	 return($result == "OK");
    }// Fin de la fonction getOK(...)
    
     // Ferme la connection du serveur TS2
     function closeSocket($socket) {
    	 fputs($socket, "quit");
    	 fclose($socket);
    }// Fin de la fonction closeSocket(...)
    
     // Création tabulation-séparated string
     function getNext($evalString) 
    {
    	 $pos	 = strpos($evalString, "\t");
    	 if(is_integer($pos)) 
    	 {
    	 	 return substr($evalString, 0, $pos);
    	 } 
    	 else 
    	 {
    	 	 return $evalString;
    	 }// end if
    }// Fin de la fonction getNext($evalString);
    
     // Supprime la tabulation-séparated string
     function chopNext($evalString) 
    {
    	 $pos	 = strpos($evalString, "\t");
    	 if(is_integer($pos)) 
    	 {
    	 	 return substr($evalString, $pos + 1);
    	 } 
    	 else 
    	 {
    	 	 return "";
    	 }// end if
    }// Fin de la fonction chopNext($evalString)
    
     // strips the quotes around a string
     function stripQuotes($evalString) 
    {
    	 if(strpos($evalString, '"') == 0) $evalString	 = substr($evalString, 1, strlen($evalString) - 1);
    	 if(strrpos($evalString, '"') == strlen($evalString) - 1) $evalString	 = substr($evalString, 0, strlen($evalString) - 1);
    
    	 return $evalString;
    }// Fin de la fonction stripQuotes($evalString)
    
     // Nom des codecs TS audio
     function getVerboseCodec($codec) 
    {
    	 if($codec == 0) 
    	 {
    	 	 $codec	 = "CELP 5.1 Kbit";
    	 } 
    	 elseif($codec == 1) 
    	 {
    	 	 $codec	 = "CELP 6.3 Kbit";
    	 } 
    	 elseif($codec == 2) 
    	 {
    	 	 $codec	 = "GSM 14.8 Kbit";
    	 } 
    	 elseif($codec == 3) 
    	 {
    	 	 $codec	 = "GSM 16.4 Kbit";
    	 } 
    	 elseif($codec == 4) 
    	 {
    	 	 $codec	 = "CELP Windows 5.2 Kbit";
    	 } 
    	 elseif($codec == 5) 
    	 {
    	 	 $codec	 = "Speex 3.4 Kbit";
    	 } 
    	 elseif($codec == 6) 
    	 {
    	 	 $codec	 = "Speex 5.2 Kbit";
    	 } 
    	 elseif($codec == 7) 
    	 {
    	 	 $codec	 = "Speex 7.2 Kbit";
    	 } 
    	 elseif($codec == 8) 
    	 {
    	 	 $codec	 = "Speex 9.3 Kbit";
    	 } 
    	 elseif($codec == 9) 
    	 {
    	 	 $codec	 = "Speex 12.3 Kbit";
    	 } 
    	 elseif($codec == 10) 
    	 {
    	 	 $codec	 = "Speex 16.3 Kbit";
    	 } 
    	 elseif($codec == 11) 
    	 {
    	 	 $codec	 = "Speex 19.5 Kbit";
    	 } 
    	 elseif($codec == 12) 
    	 {
    	 	 $codec	 = "Speex 25.9 Kbit";
    	 } 
    	 else 
    	 {
    	 	 $codec	 = "unknown (".$codec.")";
    	 }// Fin si
    	 return $codec;
    }// Fin de la fonction getVerboseCodec($codec);
    
     function getInfo() 
    {
     // ---=== main program ===---
    
     // Connection au TeamSpeak serveur
    $this->socket	 = $this->getSocket($this->serverAddress, $this->serverQueryPort, $errno, $errstr, 0.3);
    if($this->socket == false) 
    {
    	 return;
    	 echo ("No Server");
    } 
    else 
    {
    	 $this->serverStatus	 = "online";
    
    	 // Selectionne celui-là si le port est 8767
    	 $this->sendQuery($this->socket, "sel ".$this->serverUDPPort);
    
    	 // Reponse "OK"
    	 if(!$this->getOK($this->socket)) 
    	 {
    	 	 echo "Le serveur ne reponds pas \"OK\" apres la derniere commande. Arrêt.";
    	 	 return;
    	 }// Fin si
    	 // Recherche des personnes en ligne
    	 $this->sendQuery($this->socket,"pl");
    	 // Infos des personnes en ligne
    	 $this->playerList	 = array();
    	 do 
    	 {
    	 	 $playerinfo	 = fscanf($this->socket, "%s %d %d %d %d %d %d %d %d %d %d %d %d %s %s");
    	 	 list($playerid, $channelid, $receivedpackets, $receivedbytes, $sentpackets, $sentbytes, $d, $d, $totaltime, $idletime, $d, $d, $d, $s, $playername)	 = $playerinfo;
    	 	 if($playerid != "OK") 
    	 	 {
    	 	 	 $this->playerList[$playerid]	 = array("playerid" => $playerid,
    	 	 	 "channelid" => $channelid,
    	 	 	 "receivedpackets" => $receivedpackets,
    	 	 	 "receivedbytes" => $receivedbytes,
    	 	 	 "sentpackets" => $sentpackets,
    	 	 	 "sentbytes" => $sentbytes,
    	 	 	 "totaltime" => $totaltime,
    	 	 	 "idletime" => $idletime,
    	 	 	 "playername" => $this->stripQuotes($playername));
    	 	 }// Fin si
    	 } while($playerid != "OK");
    	 // Channels
    	 $this->sendQuery($this->socket,"cl");
    	 // Infos
    	 $this->channelList	 = array();
    	 do {
    	 	 $channelinfo	 = "";
    	 	 do 
    	 	 {
    	 	 	 $input	 = fread($this->socket, 1);
    	 	 	 if($input != "\n" && $input != "\r") $channelinfo .= $input;
    	 	 } while($input != "\n");
    	 	 $channelid	 = $this->getNext($channelinfo);
    	 	 $channelinfo	 = $this->chopNext($channelinfo);
    	 	 $codec		 = $this->getNext($channelinfo);
    	 	 $channelinfo	 = $this->chopNext($channelinfo);
    	 	 $parent	 = $this->getNext($channelinfo);
    	 	 $channelinfo	 = $this->chopNext($channelinfo);
    	 	 $d		 = $this->getNext($channelinfo);
    	 	 $channelinfo	 = $this->chopNext($channelinfo);
    	 	 $maxplayers	 = $this->getNext($channelinfo);
    	 	 $channelinfo	 = $this->chopNext($channelinfo);
    	 	 $channelname	 = $this->getNext($channelinfo);
    	 	 $channelinfo	 = $this->chopNext($channelinfo);
    	 	 $d		 = $this->getNext($channelinfo);
    	 	 $channelinfo	 = $this->chopNext($channelinfo);
    	 	 $d		 = $this->getNext($channelinfo);
    	 	 $channelinfo	 = $this->chopNext($channelinfo);
    	 	 $topic		 = $this->getNext($channelinfo);
    	 	 if($channelid != "OK") 
    	 	 {
    	 	 	 if($isdefault == "Default") $isdefault	 = 1; else $isdefault	 = 0;
    		 // Nombre de personnes dans les channels
    	 	 	 $playercount	 = 0;
    	 	 	 foreach($this->playerList as $playerInfo) 
    	 	 	 {
    	 	 	 	 if($playerInfo[channelid] == $channelid) $playercount++;
    	 	 	 }// end foreach
    	 	 	 $this->channelList[$channelid]	 = array("channelid" => $channelid,
    						 	 	 "codec" => $codec,
    						 	 	 "parent" => $parent,
    						 	 	 "maxplayers" => $maxplayers,
    						 	 	 "channelname" => $this->stripQuotes($channelname),
    						 	 	 "isdefault" => $isdefault,
    						 	 	 "topic" => $this->stripQuotes($topic),
    						 	 	 "currentplayers" => $playercount);
    	 	 }// end if
    	 } 
    	 while($channelid != "OK");
    	 // Ferme la connection au serveur
    	 $this->closeSocket($this->socket);
    	 }// end getInfo()
    }// class tss2info
    }
    $tss2info	 = new tss2info;
    ?>
    

     

    Voila les codes au complet...

     

    HELP ME :)

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

     Share

    ×
    ×
    • Create New...