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

    Message d'erreur TS


    FuRaX
     Share

    Recommended Posts

    Bonjour, j'ai loué mon serveur CS:S depuis hier soir et j'ai activer mon serveur TS mais le problème c'est que sur mon site j'ai ce message d'erreur:

     

    Warning: fsockopen(): unable to connect to 213.251.144.29:51234 in /home/users2/w/webjo/www/orca/modules/Teamspeak2/index.php on line 73

     

    Pouvez vous me renseigner SVP merci.

     

    Cordialement

    Link to comment
    Share on other sites

    dans mon fichier index.php j'ai mi ceci:

     

    $ipteamspeak='213.251.144.29';

    $portteamspeak='50208';

     

    pour moi c'est la bonne ip et port.

     

    par contre j'ai un autre serveur TS chez un autre hébergeur et avec son adresse ip je n'ai pas ce genre de problème.

    Link to comment
    Share on other sites

    voici le contenu de mon fichier index.php

     

     

    <?php
    if(!$user){$visiteur="0";}
    else{$visiteur=$user[1];}
    $ModName = basename( dirname( __FILE__ ) );
    if ($visiteur>=nivo_mod($ModName)){
    
    $ipteamspeak='213.251.144.29';
    $portteamspeak='50208';
    
    
    opentable();
    echo "<center>
    
    	<font size=3>[b]<big>Serveur Teamspeak  de la Team OrcA's</big>[/b]</font>
    
    ";
    
    
    class TeamSpeakServeurInfo
    {
    
    	// Public variables...
    	var $DNS;
    	var $QueryPort;
    	var $ServerPort;
    
    	var $Socket;		
    
    	function TeamSpeakServeurInfo($DNS, $QueryPort, $ServerPort)
    	{
    
    		$this->DNS         = $DNS;
    		$this->QueryPort   = $QueryPort;
    		$this->ServerPort  = $ServerPort;
    	}
    
        function Send($query)
    	{
       	    fputs($this->Socket, $query."\n");
      		}
    
        function Recive()
    	{
    
    		return fgets($this->Socket);
        }
    
    	function MakeTwoDigit($Val)
    	{
    		return str_pad($Val, 2, '0', STR_PAD_LEFT);
    	}
    
    	function GetCodec($Num)
    	{
       	    switch($Num)
    		{
             	case 0:
    			    return "CELP 5.1 Kbit";
    			case 1:
    	            return "CELP 6.3 Kbit";
    			case 2:
    	            return "GSM 14.8 Kbit";
    			case 3:
    	            return "GSM 16.4 Kbit";
    			case 4: 
    	            return "CELP Windows 5.2 Kbit";
    			default: 
        	        return "unknown ($codec)";
            }
    	}
    
    
    
    	function ProcessOutput()		
    	{
    		$this->Socket = fsockopen($this->DNS, $this->QueryPort, &$errno, &$errstr, 10); // timeout 10sec
    		if($errno!=0 or !$this->Socket) // Test if connection opened without error
    		{
    			Return "Error : $errstr ($errno)";
    		}
    		iF($this->Recive()!="[TS]\r\n") // Test the first TS server response (Must be [TS] or then error)
    		{
    	        fclose($this->Socket);
    			Return 'Error : No server TeamSpeak at this address';
    		}
    
    		// === Select the server ===
    		$this->Send('sel '.$this->ServerPort);
    		if($this->Recive()!="OK\r\n") // check select server error
    		{
    			fputs($this->Socket, "quit");
          			fclose($this->Socket);
    			return 'Error when selecting the TS server port';
    		}
    
    		// === Get the users list ===
    	    $this->Send('pl'); // pl for PlayersList
    
    	    $PlayerList = array();
    		$NumPlayer = 0;			
    	    while($PlayerID!='OK') // exit loop if no more player
    		{
    
    			$Buffer = trim($this->Recive());
    			$PlayerInfo = explode("\t", $Buffer);
    
    			$PlayerID = $PlayerInfo[0];
    			if($PlayerID=='OK') break; // exit loop if no more player
    			if($PlayerID!='p_id')
    			{				
    				// find all player info...
    				$PlayerChannel = $PlayerInfo[1];
    				$PlayerPing    = $PlayerInfo[7];
    
    				$LoginTime = $PlayerInfo[8];
    				$LoginTime = $this->MakeTwoDigit(floor($LoginTime / 3600)).
    	  			         ':'.$this->MakeTwoDigit(floor(($LoginTime % 3600) / 60)).
    		                 ':'.$this->MakeTwoDigit($LoginTime % 60); 
    
    			    $IDLE_Time = $PlayerInfo[9];
    				$IDLE_Time = $this->MakeTwoDigit(floor($IDLE_Time / 3600)).
      				         ':'.$this->MakeTwoDigit(floor(($IDLE_Time % 3600) / 60)).
    	        	         ':'.$this->MakeTwoDigit($IDLE_Time % 60);
    
    				$PlayerName = trim($PlayerInfo[14], '"');
    
    				// Add the current player info to the list
    				array_push($PlayerList, array('ID'=>$PlayerID, 'Name'=>$PlayerName, 'Channel'=>$PlayerChannel, 'Ping'=>$PlayerPing, 'LoginTime'=>$LoginTime, 'IDLE_Time'=>$IDLE_Time));
    				$NumPlayer++;			
    			}
    	    }
    
    		// === Get the users list ===
    	    $this->Send('cl'); // cl for ChannelList
    
    	    $ChannelList = array();
    	    while($ChannelID != "OK") // exit loop if no more channel
    		{
    			$Buffer = trim($this->Recive());
    			$ChannelInfo = explode("\t", $Buffer);
    
    			$ChannelID = $ChannelInfo[0];
    			if($ChannelID=='OK') break; // exit loop if no more channel
    
    			// find all channel info...
    			$ChannelCodec = $ChannelInfo[1];
    			$ChannelParent = $ChannelInfo[2];
           		$MaxPlayers = $ChannelInfo[4];
    			$ChannelName = trim($ChannelInfo[5],'"');
    			$ChannelPassword = $ChannelInfo[7];
    			$ChannelIsDefault = $ChannelInfo[8];
    
    			// Add the current channel info to the list
    			array_push($ChannelList, array('ID'=>$ChannelID, 'Name'=>$ChannelName, 'Parent'=>$ChannelParent, 'Codec'=>$this->GetCodec($ChannelCodec), 'MaxPlayers'=>$MaxPlayers, 'Password'=>$ChannelPassword, 'IsDefault'=>$ChannelIsDefault));
       	    }
    
    		ob_start();
    
    	?>
    	<Style type="text/css">
    		.CSS_TS_TableOutside	{
    					border:2px #000000 solid;
    					background-color:#9CBDBD; color:#000000}
    		.CSS_TS_Table	{
    					border:1px #000000 solid;
    					background-color:#9CBDBD; color:#000000;
    					padding: 3px}
    		.CSS_TS_TableInside	{
    					font-size:8pt; font-family:MS Sans Serif, Arial, Helvetica, sans-serif;
    					background-color:#9CBDBD; color:#000000}
    		.CSS_TS_Codec	{
    					font-size:8pt; font-family:MS Sans Serif, Arial, Helvetica, sans-serif;
    					color:#9CBDBD}
    	</Style>
    
    		<Table border="0" cellpadding="0" cellspacing="2" Class="CSS_TS_TableOutside">
    			<TR>
    				<TD Class="CSS_TS_Table">
    
    		<Table border="0" cellpadding="0" cellspacing="0" Class="CSS_TS_TableInside">
    			<TR>
    				<TD>
    					[img=images/serverimage.gif]Serveur Teamspeak
    				</TD>
    				<TD Align="center">
    
    				</TD>
    				<TD Align="center">
    
    				</TD>
    			</TR>
    <?
    
    
    			Foreach($ChannelList as $Channel)
    			{
    				If($Channel['Parent']==-1)
    				{
    ?>
    					<TR>
    						<TD>
    							[img=images/channelimage.gif]<?=IIF($Channel['Password']=='1', '[img=images/lock.gif]', '')?><?=$Channel['Name']?><Span Class="CSS_TS_Codec">(<?=$Channel['Codec']?>)</Span>
    						</TD><TD></TD><TD></TD><TD></TD>
    					</TR>
    <?
    					Foreach($ChannelList as $SubChannel)
    					{
    						If($SubChannel['Parent']==$Channel['ID'])
    						{
    ?>
    							<TR>
    								<TD>
    									[img=images/channelimage.gif]<?=IIF($Channel['Password']=='1', '[img=images/lock.gif]', '')?><?=$SubChannel['Name']?> <Span Class="CSS_TS_Codec">(<?=$SubChannel['Codec']?>)</Span>
    								</TD><TD></TD><TD></TD><TD></TD>
    							</TR>
    <?
    							Foreach($PlayerList as $Player)
    							{
    								If($Player['Channel']==$SubChannel['ID'])
    								{
    ?>
    									<TR>
    										<TD>
    											[img=images/playerimage.gif][img=images/lock.gif]<?=$Player['Name']?>
    										</TD>
    										<TD Align="center">
    											<?=$Player['LoginTime']?>
    										</TD>				
    										<TD Align="center">
    											<?=$Player['IDLE_Time']?>
    										</TD>
    										<TD>
    											<Span Class="CSS_TS_Codec">(Ping <?=$Player['Ping']?>)</Span>
    										</TD>				
    									</TR>
    <?
    								}
    							}
    						}
    					}
    					Foreach($PlayerList as $Player)
    					{
    						If($Player['Channel']==$Channel['ID'])
    						{
    ?>
    							<TR>
    								<TD>
    									[img=images/playerimage.gif]<?=$Player['Name']?>
    								</TD>				
    								<TD Align="center">
    									<?=$Player['LoginTime']?>
    								</TD>				
    								<TD Align="center">
    									<?=$Player['IDLE_Time']?>
    								</TD>				
    								<TD>
    									<Span Class="CSS_TS_Codec">(Ping <?=$Player['Ping']?>)</Span>
    								</TD>				
    							</TR>
    <?
    						}
    					}
    				}				
    			}
    ?>
    		</Table>		
    
    				</TD>
    			</TR>
    		</Table>
    <?			
    		$Buffer = ob_get_contents();
    		ob_end_clean();
    
    		Return array($Buffer, $NumPlayer);
    	}
    }
    
    //	*************************************************************************************
    //	*** FIN DE LA CLASS *****************************************************************
    //	*************************************************************************************
    
    function IIF($cond, $vrai, $faut) 
    	{ 
     		if($cond==true) 
     		{ 
     			return $vrai; 
     		} 
     		else 
     		{ 
     			return $faut; 
     		} 
    	} 
    
    
    
    //opentable()						
    
    
    //	$TS = new TeamSpeakServeurInfo('195.68.36.69', '51234', '8767');
    $TS = new TeamSpeakServeurInfo($ipteamspeak, '51234', $portteamspeak);
    list($Tableau, $NumPlayer) = $TS->ProcessOutput();
    
    echo($Tableau); // Faut faire un Echo pour voir le tableau :)
    echo('il y a '.$NumPlayer.' connection');
    if ($numplayer>'1') {
    echo('s');
    }
    echo(' sur le serveur'); // :)
    echo"</center>";	
    $userts=$user[2];
    echo('<a href=teamspeak://'.$ipteamspeak.':'.$portteamspeak.'?nickname='.$userts.'><font size=2>Se connecter a ce serveur</font></a>
    ');
    echo"</center>";	
    closetable();
    }else{opentable();echo"
    
    <center>Module reservé
    
    <a href=\"javascript:history.back()\">[b]Retour[/b]</a>
    
    </center>";closetable();}
    
    ?>
    

    Link to comment
    Share on other sites

    Ne te serais-tu pas trompé de queryport ... ?

     

    :roll:

     

    voici le contenu de mon fichier index.php

     

     

    [...]
    $ipteamspeak='213.251.144.29';
    $portteamspeak='50208';
    
    [...]
    
    	function TeamSpeakServeurInfo($DNS, $QueryPort, $ServerPort)
    	{
    
    		$this->DNS         = $DNS;
    		$this->QueryPort   = $QueryPort;
    
    [...]
    
    //	$TS = new TeamSpeakServeurInfo('195.68.36.69', '51234', '8767');
    $TS = new TeamSpeakServeurInfo($ipteamspeak, '51234', $portteamspeak);
    list($Tableau, $NumPlayer) = $TS->ProcessOutput();
    
    [...]

     

    Tu penses que ton queryport est le 51234 ????

     

    Je sais que je suis chiant,... mais la fonction recherche est bien pratique dans ce forum ... :roll:

     

    Changement du port TCP pour TS

    Module + Block Teamspeak pour Nuked-Klan

     

    :?

    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...