Community Forums Today's Posts     Member List     Archive    
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    Join Date
    Jan 2010
    Location
    uk
    Posts
    4
    Debug Mode activated!
    The following errors where thrown:
    Can not connect to the server

    I get from latest script, i dont know php so please bare with me on this
    one, this script is basically connecting to the query server, then taking in
    tokenlist as an array and outputing it? (or generating new one etc)

    This is exactly what i need for my forum integration mod, however, when
    testing the basic commands on queryserver locally all is fine, remotely tho
    im getting insufficient client priveleges error, so the query server is
    looking for another user identifier other than just query admin / password?

    Could you modify your script to output whole error string from query so i
    can see for sure?

  2. #17
    Join Date
    Apr 2007
    Location
    Germany
    Posts
    98
    Please post all configuration data you filled in BUT WITHOUT PASSWORD.

    Maybe we can find any mistake...

  3. #18
    Join Date
    Jan 2010
    Location
    uk
    Posts
    4
    PHP Code:
    <?php 
     
    // IP-Adress of the TS3-Server (NOT localhost or 127.0.0.1) 
    $ip '208.111.39.189'

    // query-port of the TS3-Server (default: 10011) 
    $t_port '10011'

    // ID of the virtual server 
    $sid '4'

    // Login-name for query 
    $Login_Name 'admin'

    // password for query-user 
    $Login_pwd 'xxxxxx'

    // ID of the group tokens will be displayed from 
    $Group_id '16'

    // Message if there are no tokens available 
    $NoTokens 'No tokens available, please contact your serveradministrator!'

    // Generate a Token if there is none (0=No, display message instead | 1=Yes 
    $GenerateToken false

    // Here you can enter Text to be displayed before and after each token  
    // (e.g. before="<li>" and after = "</li>" to display Tokens in an unordered list) 
    $TextBefore ''
    $TextAfter '<br /><br />'

    // Here you are able to activate the debug-mode (true / false) 
    $debug true

    // Don't change anything from here on (Except you know what you are doing)! 

    $error = array(); 
    $FMToken = array(); 

    function 
    sendCmd($fp$cmd){ 
        
    $msg ''
        
    fputs($fp$cmd); 
        while(
    strpos($msg'msg=') === false){ 
            
    $msg .= fread($fp8096); 
        } 
        if(!
    strpos($msg'msg=ok')){ 
            return 
    false
        }else{ 
            return 
    $msg
        } 


    function 
    readToken ($fp){ 
        global 
    $Group_id
        global 
    $NoTokens
        
    $FMToken[0] = $NoTokens
        
    $cmd="tokenlist\n"
        
    $i=0
        if(!(
    $tokens sendCmd($fp$cmd))){ 
            
    $error[] = 'no tokens availible'
        }else{ 
            
    $zeichen explode('|',$tokens); 
            foreach (
    $zeichen as &$token) { 
                
    $token explode(' ',$token); 
                if (
    $token[2]=='token_id1='.$Group_id){ 
                    
    $ausgabe explode('=',$token[0]); 
                    
    $FMToken[$i] = stripcslashes($ausgabe[1]); 
                    
    $i++; 
                } 
            } 
        } 
        return 
    $FMToken


    function 
    makeToken ($fp){ 
        global 
    $Group_id
        
    $cmd="tokenadd tokentype=0 tokenid1=".$Group_id." tokenid2=0\n"
        
    $newToken=sendCmd($fp$cmd); 
        return 
    $newToken


    error_reporting(E_ALL); 

         
    If (
    $ip === "127.0.0.1" || $ip === "localhost") { 
      
    $error[] = 'Connection failed! Use your external IP, <b>NOT</b> "localhost" or "127.0.0.1"!'
    } else { 
      
    $fp = @fsockopen($ip$t_port$errno$errstr2); 
      if(
    $fp){ 
          
    $cmd "use sid=".$sid."\n"
          if(!(
    $select sendCmd($fp$cmd))){ 
              echo (
    "Auf Server 1 geschaltet"); 
              
    $error[] = 'Wrong Server ID'
          } 
       
          
    $cmd="login $Login_Name $Login_pwd\n"
          if(!(
    $sinfo sendCmd($fp$cmd))){ 
              
    $error[] = 'Login Denied'
          } 
       
          
    $FMToken readToken($fp); 
          if (
    $FMToken[0] === $NoTokens){ 
              if (
    $GenerateToken){ 
                  
    $NewToken makeToken($fp); 
                  
    $FMToken readToken($fp); 
              } 
          } 
       
           
      }else{ 
          
    $error[] = 'Can not connect to the server'
      } 


    // here is the loop for the output. Add HTML-Code if you want a nice result 
    // Hier ist die Schleife für die Ausgabe. Fürge HTML-code hinzu, wenn du eine schönere Ausgabe wünscht. 

    If ($debug) { 
      echo 
    "<b>Debug Mode activated!</b><br>The following errors where thrown:<br><font color='red'>"
      foreach (
    $error as $aerror){ 
        echo 
    $aerror."<br>"
      } 
      echo 
    "</font><br><br>"
    } else { 
      foreach (
    $FMToken as $AToken){ 
        echo 
    $TextBefore.($AToken).$TextAfter
      } 


    ?>
    Theres the code with my config (password blanked) here is local query;
    login admin xxxxx
    use sid=4
    tokenlist

    Ouput:
    error id=0 msg=ok (5 ms)
    error id=0 msg=ok (270 ms)
    token=xxxxxxxxxxxx

    Remote output says insufficient client priveleges, is it wanting query commands from ip i registered the query password with? hence the code
    failing also?
    Last edited by MIKEYK255; 19-01-2010 at 17:01.

  4. #19
    Join Date
    Apr 2007
    Location
    Germany
    Posts
    98
    Replace line 110:
    Code:
    $error[] = 'Can not connect to the server';
    with
    Code:
    $error[] = 'Can not connect to the server. ' . $errstr . '(' . $errno  . ')';
    It should post the exact error now... If it doesn't, search for line 87 and remove the "@" in front of the "@fsockopen"-part. Then post your results here pls.

  5. #20
    Join Date
    Jan 2010
    Location
    uk
    Posts
    4
    Debug Mode activated!
    The following errors where thrown:
    Can not connect to the server. Connection timed out(110)

    ----

    So i went back to query, if i telnet to my server 208.111.39.189 on 10011
    this is what i get locally:-

    Code:
    TS3
    use sid=4
    error id=0 msg=ok
    login client_login_name=admin client_login_password=xxxxxx
    error id=0 msg=ok
    tokenlist
    token=wZoBGCTaLR3.......
    However asking someone else to telnet with the same details from remote
    machine they get:-
    Code:
    TS3
    use sid=4
    error id=0 msg=ok
    login client_login_name=admin client_login_password=xxxxxx
    error id=0 msg=ok
    tokenlist
    error id=2568 msg=insufficient\sclient\spermissions failed_permid=8741
    So.. query password seems to work from local address only, to test this i made some1 else on my server sa and asked them to create their own query login then retry telnet, it works then.

    So im thinking i need to make a new ts account for the script itself and make it sa, once it has this should be able to execute remotely?

    One thing though.. why am i getting timeout error, should be getting "error id=2568 msg=insufficient...."

  6. #21
    Join Date
    Jan 2010
    Location
    Duesseldorf, Germany
    Posts
    33
    @MIKEYK255: Many thanks for improving my script. I'm not a native english-speaker, therefore some mistakes inside. I'm not so very familliar with PHP.

    @Lil-rich: Try to use the "serveradmin" generated by the server at the first start. If this works we know that the user you are using don't has the privilegs required.
    I have another Question: Which forum-System you are using? I'm trying to integrate the script in my WBB 3.0-Bord by using a PHP-Class and a template and not simply including the PHP-script. Perhaps we can work together.

  7. #22
    Join Date
    Apr 2007
    Location
    Germany
    Posts
    98
    Quote Originally Posted by Harry.Fox View Post
    @MIKEYK255: Many thanks for improving my script. I'm not a native english-speaker, therefore some mistakes inside. I'm not so very familliar with PHP.

    @Lil-rich: Try to use the "serveradmin" generated by the server at the first start. If this works we know that the user you are using don't has the privilegs required.
    I have another Question: Which forum-System you are using? I'm trying to integrate the script in my WBB 3.0-Bord by using a PHP-Class and a template and not simply including the PHP-script. Perhaps we can work together.
    I think you confused the names, didn't you? ^^ I am glad that I could help you a bit.

    If you have any further questions about PHP or integrating it somewhere feel free to contact me via pm...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Linux server startup script!
    By mancert in forum Linux / FreeBSD
    Replies: 159
    Last Post: 24-09-2011, 16:51
  2. New Teamspeak Query script for php: Teamspeak Display
    By MrGuide@NL in forum [TeamSpeak 2] Addons & Scripts
    Replies: 347
    Last Post: 06-08-2010, 17:17
  3. Create token by php script and mysql
    By Wikibear in forum Permission System
    Replies: 6
    Last Post: 28-12-2009, 19:31
  4. [BUG-Feedback] About Token
    By Blutgerinsel in forum Server Support
    Replies: 0
    Last Post: 26-12-2009, 14:28
  5. Bug? Token System
    By Gubi1990 in forum Bug Reports
    Replies: 4
    Last Post: 21-12-2009, 22:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •