Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Page 43 of 100 FirstFirst ... 3341424344455393 ... LastLast
Results 631 to 645 of 1498
  1. #631
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    Quote Originally Posted by Arik23 View Post
    Hay to everyone, im using the framework to create an Teamspeak viewer, wich is implemented on my homepage.

    Everything works perfect, but today i get an big error. I host my homepage on an virtual server, they have 512 mb Real RAM. If people everytime reload (spam reload) the tsviewer page, the server close all conections cause it runs Out of memory. That isnt great for my hosten teamspeak server on it cause it also closes connections... think the server is flooded then. How can i prevent that?

    i also tried to use ini_set("memory_limit","10M"); in my tsviewer script, but it wont help also 4 mb doesnt prevent. if everything on my server runs, without opened ts3viewer they have arround 230 mb RAM used.

    Hope someone can help. And sorry for my bad english cause im german :lol:

    Greetings Arik
    Well... The best way would be implementing some king of simple caching functionality. What's the code you're using to generate the viewer?

  2. #632
    Join Date
    February 2013
    Posts
    18
    Hay, thanks for answering and trying to help me, here is the code i use.

    Code:
    <?php
    
    /* set error reporting levels */
    error_reporting(E_ALL | E_STRICT);
    
    
    
    /* set default timezone */
    
    date_default_timezone_set("Europe/Berlin");
    
    
    /* load config file */
    $cfg = db_fetch_assoc(db_query("SELECT host, query, voice, user, pass FROM `prefix_ts3viewer`"));
    
    
    /* load framework library */
    
    require_once("include/includes/func/teamspeak3/TeamSpeak3.php");
    
    
    
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
    
    
    <head>
    
      <title>Teamspeak 3 Viewer</title>
    
    
    
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    
      <meta http-equiv="cache-control" content="no-cache" />
    
      <meta http-equiv="pragma" content="no-cache" />
    
      <meta http-equiv="expires" content="-1" />
    
    
    
      <meta name="robots" content="noindex, nofollow" />
    
      <meta name="generator" content="TeamSpeak 3 PHP Framework <?= TeamSpeak3::LIB_VERSION; ?>" />
    
      <meta name="resource-type" content="Document" />
    
    
    
      <style type="text/css" media="screen">
    
      <!--
    
        body {
          background-color: #272727;
    
          color: #FFFFFF;
    
          font-family: Tahoma, Helvetica, Arial, sans-serif;
    
          font-size: 12px;
    
          line-height: 1.25em;
    
        }
    
        img {
    
          border: 0px;
    
        }
    
    
    
        a {
    
          color: #FFFFFF;
    
          text-decoration: underline;
    
        }
    
    
    
        a:hover {
    
          color: #FFFFFF;
    
          text-decoration: none;
    
        }
    
    
    
        table.ts3_viewer {
    
          width: 100%;
    
          border: 0px;
    
          border-collapse: collapse;
    
        }
    
    
    
        table.ts3_viewer tr.row1 {
    
          background: transparent;
    
        }
    
    
    
        table.ts3_viewer tr.row2 {
    
          background: #272727;
    
        }
    
    
    
        table.ts3_viewer td {
    
          white-space: nowrap;
    
          padding: 0px 0px 1px 0px;
    
          border: 0px;
    
        }
    
    
    
        table.ts3_viewer td.corpus {
    
          width: 100%;
    
        }
    
    
    
        table.ts3_viewer td.query {
    
          font-style: italic;
    
          color: #272727;
    
        }
    
    
    
        table.ts3_viewer td.spacer {
    
          overflow: hidden;
    
        }
    
    
    
        table.ts3_viewer td.left {
    
          text-align: left;
    
        }
    
    
    
        table.ts3_viewer td.right {
    
          text-align: right;
    
        }
    
    
    
        table.ts3_viewer td.center {
    
          text-align: center;
    
        }
    
    
    
        table.ts3_viewer td.suffix {
    
          vertical-align: top;
    
        }
    
    
    
        table.ts3_viewer td.suffix img {
    
          padding-left: 2px;
    
          vertical-align: top;
    
        }
    
    
    
        table.ts3_viewer td.spacer.solidline {
    
          background: url('include/images/teamspeak3/viewer/spacer_solidline.gif') repeat-x;
    
        }
    
    
    
        table.ts3_viewer td.spacer.dashline {
    
          background: url('include/images/teamspeak3/viewer/spacer_dashline.gif') repeat-x;
    
        }
    
    
    
        table.ts3_viewer td.spacer.dashdotline {
    
          background: url('include/images/teamspeak3/viewer/spacer_dashdotline.gif') repeat-x;
    
        }
    
    
    
        table.ts3_viewer td.spacer.dashdotdotline {
    
          background: url('include/images/teamspeak3/viewer/spacer_dashdotdotline.gif') repeat-x;
    
        }
    
    
    
        table.ts3_viewer td.spacer.dotline {
    
          background: url('include/images/teamspeak3/viewer/spacer_dotline.gif') repeat-x;
    
        }
    
    
    
        span.error {
    
          color: #CF3738;
    
        }
    
      -->
    
      </style>
    
    
    
    </head>
    
    
    
    <body>
    
    
    
    <?php
    
    
    
    try
    
    {
    
      /* connect to server, authenticate and get TeamSpeak3_Node_Server object by URI */
    
      $ts3 = TeamSpeak3::factory("serverquery://" . $cfg["user"] . ":" . $cfg["pass"] . "@" . $cfg["host"] . ":" . $cfg["query"] . "/?server_port=" . $cfg["voice"] . "#no_query_clients");
    
    
    
      /* enable new display mode */
    
      $ts3->setLoadClientlistFirst(TRUE);
    
    
    
      /* display viewer for selected TeamSpeak3_Node_Server */
    
      echo $ts3->getViewer(new TeamSpeak3_Viewer_Html("include/images/teamspeak3/viewer/", "include/images/teamspeak3/flags/", "data:image"));
      echo '<center><form name="input" action="ts3server://myip.de" method="get">
            Nickname: <input type="text" name="nickname" />
            <input type="submit" value="connect" /></center>
            </form>';
    
    
    }
    
    catch(Exception $e)
    
    {
    
      /* echo error message */
    
      echo "<p><span class=\"error\"><b>ERROR 0x" . dechex($e->getCode()) . "</b>: " . htmlspecialchars($e->getMessage(), ILCH_ENTITIES_FLAGS, ILCH_CHARSET) . "</span></p>";
    
    }
    
    
    
    ?>
    
    
    
    </body>
    
    
    
    </html>
    edit// nobody can help?
    Last edited by Arik23; June 8th, 2013 at 09:43 PM.

  3. #633
    Join Date
    August 2007
    Location
    Berlin
    Posts
    12
    what i have to do that a token get generated from my WP Website?

    When a User register at our page he get a e-mail from our page with a generated password, and in that email i want that there is the generated token too.

    can any one explain me how does this work?
    or have some minutes to talk with me at TS?

  4. #634
    Join Date
    August 2007
    Location
    Berlin
    Posts
    12
    ok i have it so far, but i dont get it that the phpfile gives me a echo from the generated servergroup token. :/ can some one help me?

  5. #635
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    Quote Originally Posted by Arik23 View Post
    My apologies for the late response... I was on vacation.
    My apologies for the late response... I was on vacation.



    Well, instead of echoing the return value of getViewer(), I'd recommend that you write it to a file (using file_put_contents() for example). Then you simply check if that file already exists and if its last modification date (you can get that with filemtime()) was less than n minutes ago. If it is, you simply echo the contents of that file instead of querying the TS3 server.

    Quote Originally Posted by HellCap View Post
    ok i have it so far, but i dont get it that the phpfile gives me a echo from the generated servergroup token. :/ can some one help me?
    Shouldn't be a big deal... Do you have a snippet of your code?

  6. #636
    Join Date
    September 2012
    Posts
    5
    I'm trying to make a form that allows myself to create privilege keys.

    PHP Code:
        $ts3_ServerInstance TeamSpeak3::factory("serverquery://username:[email protected]/#no_query_clients");
        
    $ts3_VirtualServer $ts3_ServerInstance->serverGetById($vsid);
        
    $groups =  $ts3_VirtualServer->serverGroupList();
        foreach (
    $groups as $group) {
            if(
    $group["type"] == TeamSpeak3::GROUP_DBTYPE_REGULAR)
            return 
    $group;
        } 
    The form outputs:
    Code:
    <div class="form_row"><select name="tsuid">
    <option value="0">CAPT Tieria</option>
    <option value="1">Hitakashi</option>
    </select>
    </div>
    and this is the code that outputs the above:
    Code:
    $form_container = new FormContainer();
    $form = new Form();
        $form_container->output_row("User"." <em>*</em>", ''
        , $form->generate_select_box('tsuid', $teamspeak->getServerGs(1),
        array('id' => 'tsuid')));
        $form->end();
        $form_container->end();
    But as you see it outputs the usernames in the group, May be the way MyBB handles the form and I may have to just do it without using MyBB functions. Just posting to ask if I'm doing it wrong and that's why it's outputting usernames instead of groups.

  7. #637
    Join Date
    July 2013
    Posts
    3
    Hi,

    My script is run in the terminal debian (php bot.php). When i run, it create a lot of "Current Queries". How kill old query? unset() doesn't work.

    I wanted refresh current connection, but I don't see good method.

    Refresh method:

    Code:
    <?php
    /**
     * @name Display TS3 Status and Clientcount
     * @author SilentStorm
     */
    ini_set( 'display_errors', 'Off' ); 
    error_reporting( E_ALL );
    class bot
    {
    	public $odbiorcy=array();
    	public $ts;
    	public function __construct()
    	{
    		header('Content-Type: text/html; charset=utf8');
    		date_default_timezone_set("Europe/London");
    		require_once("./ts/libraries/TeamSpeak3/TeamSpeak3.php");
    		TeamSpeak3::init();	
    		if($this->ts3 = TeamSpeak3::factory("serverquery://login:[email protected]/?server_port=9987#no_query_clients"))
    		echo "Connect\n";
    		else echo "Error\n";
    		
    	}
    	function send_message()
    	{
    		$connect=$this->ts3;
    //now refresh status, client and channel
    */....*/
    		
    		sleep(10);
    		return $this->send_message();
    	}
    }
    
    $start= new bot;
    $start->send_message();
    	
    ?>
    Kill old query method:

    Code:
    <?php
    /**
     * @name Display TS3 Status and Clientcount
     * @author SilentStorm
     */
    ini_set( 'display_errors', 'Off' ); 
    error_reporting( E_ALL );
    class bot
    {
    	public $odbiorcy=array();
    	function send_message()
    	{
    		header('Content-Type: text/html; charset=utf8');
    		date_default_timezone_set("Europe/London");
    		require_once("./ts/libraries/TeamSpeak3/TeamSpeak3.php");
    		TeamSpeak3::init();	
    		$ts3 = TeamSpeak3::factory("serverquery://login:[email protected]/?server_port=9987#no_query_clients");
    */...*/
    
    unset($ts); //it doesn't work
    		sleep(10);
    		return $this->send_message();
    	}
    }
    
    $start= new bot;
    $start->send_message();
    	
    ?>
    Thx

  8. #638
    Join Date
    July 2013
    Posts
    3
    Hi,

    My script is run in the terminal debian (php bot.php). When i run, it create a lot of "Current Queries". How kill old query? unset() doesn't work.

    I wanted refresh current connection, but I don't see good method.

    Refresh method:

    Code:
    <?php
    /**
     * @name Display TS3 Status and Clientcount
     * @author SilentStorm
     */
    ini_set( 'display_errors', 'Off' ); 
    error_reporting( E_ALL );
    class bot
    {
    	public $odbiorcy=array();
    	public $ts;
    	public function __construct()
    	{
    		header('Content-Type: text/html; charset=utf8');
    		date_default_timezone_set("Europe/London");
    		require_once("./ts/libraries/TeamSpeak3/TeamSpeak3.php");
    		TeamSpeak3::init();	
    		if($this->ts3 = TeamSpeak3::factory("serverquery://login:[email protected]/?server_port=9987#no_query_clients"))
    		echo "Connect\n";
    		else echo "Error\n";
    		
    	}
    	function send_message()
    	{
    		$connect=$this->ts3;
    //now refresh status, client and channel
    */....*/
    		
    		sleep(10);
    		return $this->send_message();
    	}
    }
    
    $start= new bot;
    $start->send_message();
    	
    ?>
    Kill old query method:

    Code:
    <?php
    /**
     * @name Display TS3 Status and Clientcount
     * @author SilentStorm
     */
    ini_set( 'display_errors', 'Off' ); 
    error_reporting( E_ALL );
    class bot
    {
    	public $odbiorcy=array();
    	function send_message()
    	{
    		header('Content-Type: text/html; charset=utf8');
    		date_default_timezone_set("Europe/London");
    		require_once("./ts/libraries/TeamSpeak3/TeamSpeak3.php");
    		TeamSpeak3::init();	
    		$ts3 = TeamSpeak3::factory("serverquery://login:[email protected]/?server_port=9987#no_query_clients");
    */...*/
    
    unset($ts); //it doesn't work
    		sleep(10);
    		return $this->send_message();
    	}
    }
    
    $start= new bot;
    $start->send_message();
    	
    ?>
    Thx

  9. #639
    Join Date
    December 2009
    Location
    York, UK
    Posts
    23
    Code:
    <?php
    
    require_once("TeamSpeak3.php");
    
    
    // connect and grab TeamSpeak3_Node_Host object
    $instance = TeamSpeak3::factory("serverquery://127.0.0.1:10011");
    
    
    // login using serveradmin account
    $instance->login("serveradmin", "Password");
    
    
    // select virtual server and grab TeamSpeak3_Node_Server object
    $virtualserver = $instance->serverGetByPort(9987);
    
    
    // grab TeamSpeak3_Node_Servergroup object
    $group = $virtualserver->serverGroupGetByName("Server Admin");
    
    
    // create privilege key
    privilegeKeyCreate(0,2,1);
    ?>
    Ripping my hear out over this one. Framework connects then times out... I can't find any errors either. FYI, I took the username and password out for obvious reasons.

  10. #640
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    Quote Originally Posted by Hitakashi View Post
    I'm trying to make a form that allows myself to create privilege keys.

    ...

    But as you see it outputs the usernames in the group, May be the way MyBB handles the form and I may have to just do it without using MyBB functions. Just posting to ask if I'm doing it wrong and that's why it's outputting usernames instead of groups.
    I assume that the generate_select_box() method expects an associative array of elements. So replace the PHP code you wrote with this snippet:

    PHP Code:
    $ts3_ServerInstance TeamSpeak3::factory("serverquery://username:[email protected]/#no_query_clients"); 
    $ts3_VirtualServer  $ts3_ServerInstance->serverGetById($vsid); 
    $ts3_GroupFilter    = array("type" => TeamSpeak3::GROUP_DBTYPE_REGULAR);

    return 
    $ts3_VirtualServer->serverGroupList($ts3_GroupFilter); 
    This will return an array of all regular server groups where the key is the ID of the group. Passing an array to the serverGroupList() method allows you to filter for specified property values (in this case we filter for type).

    Quote Originally Posted by Heliguy View Post
    Ripping my hear out over this one. Framework connects then times out... I can't find any errors either. FYI, I took the username and password out for obvious reasons.
    You're missing the $virtualserver in front of privilegeKeyCreate(). Or if you want to create a privilege key for the group you queried, simply do this:

    PHP Code:
    $group->privilegeKeyCreate(); 

  11. #641
    Join Date
    December 2009
    Location
    York, UK
    Posts
    23
    Hi,

    I now get this eror
    Code:
    Fatal error: Uncaught exception 'TeamSpeak3_Adapter_ServerQuery_Exception' with message 'invalid groupID' in /usr/local/lsws/DEFAULT/html/phpvmsteamspeak/api/Node/Server.php:1133 Stack trace: #0 /usr/local/lsws/DEFAULT/html/phpvmsteamspeak/gettoken.php(19): TeamSpeak3_Node_Server->serverGroupGetByName('Server Admin') #1 {main} thrown in /usr/local/lsws/DEFAULT/html/phpvmsteamspeak/api/Node/Server.php on line 1133
    EDIT: Solved that by making the framework select the group another way, it works fine now. My new problem is on my view token list script. This is my code dump:
    Code:
    <?php
    //To debug any errors
    error_reporting(E_ALL); 
    ini_set( 'display_errors','1');
    
    
    //loads framework
    require_once("api/TeamSpeak3.php");
    
    
    //Makes instance for connection
    $instance = TeamSpeak3::factory("serverquery://127.0.0.1:10011");
    
    
    //Auths connection
    $instance->login("serveradmin", "password");
    
    
    //Connects to virtual server specified by port
    $virtualserver = $instance->serverGetByPort(1234);
    
    
    //Selects group for privilege key view
    $group = $virtualserver->serverGroupGetByID(2);
    
    
    //Views privilege key for group above and shows it on the browser.
    echo $group->privilegeKeyList();
    ?>
    My web browser dump:
    Code:
    Notice: Array to string conversion in /usr/local/lsws/DEFAULT/html/phpvmsteamspeak/viewtoken.php on line 22
    Array
    Thanks for all your help so far!
    Last edited by Heliguy; July 14th, 2013 at 11:11 PM.

  12. #642
    Join Date
    October 2003
    Location
    Germany
    Posts
    2,527
    The "Array to string conversion" notice is shown because privilegeKeyList() returns an array containing existing privilege keys... not a string that you can echo.

  13. #643
    Join Date
    July 2013
    Posts
    1
    Code:
    === Release 1.1.20 - 04 Mar 2013 ===
     ! updated online and offline docs to Doxygen 1.8.3.1
     ! added online examples (http://demos.planetteamspeak.com/ts3/php/framework/)
     - removed outdated example scripts
     * TeamSpeak3_Node_Server::sortFileList() now sorts existing folders first in 
       alphabetical order
     * public legacy release
    Very nice examples, 403 forbidden.

  14. #644
    Join Date
    December 2009
    Location
    York, UK
    Posts
    23
    Ok, thanks.

  15. #645
    Join Date
    December 2009
    Location
    York, UK
    Posts
    23
    So, how I do go about displaying the "privilege key list" on the browser.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. PHP Framework
    By Multivit4min in forum Permission System
    Replies: 1
    Last Post: June 29th, 2015, 11:28 AM
  2. PHP Framework
    By phil998 in forum Server Support
    Replies: 0
    Last Post: February 25th, 2015, 06:27 PM
  3. TS3 PHP Framework Visualizations
    By Ronin Design in forum Tools / Web Based
    Replies: 2
    Last Post: February 22nd, 2015, 05:04 AM
  4. Extraction using the Framework
    By HarryMW in forum Tools / Web Based
    Replies: 1
    Last Post: August 3rd, 2012, 07:04 PM
  5. Teamspeak, PHP Framework?
    By mario2027 in forum General Questions
    Replies: 1
    Last Post: December 21st, 2010, 09:30 AM

Tags for this Thread

Posting Permissions

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