Jump to content

825orion

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by 825orion

  1. 17 hours ago, web541 said:

    Haven't tested this, but you can try this

    Download and place the following files in a new folder called lib core/modules/Keys/(lib)

    https://github.com/Moc/teamspeak3/tree/master/libraries/TeamSpeak3

    I assume that's the library you were previously using, I've just linked it differently.

     

      Hide contents

     

    
    
    <?php
    /**
     * phpVMS - Virtual Airline Administration Software
     * Copyright (c) 2008 Nabeel Shahzad
     * For more information, visit www.phpvms.net
     *	Forums: http://www.phpvms.net/forum
     *	Documentation: http://www.phpvms.net/docs
     *
     * phpVMS is licenced under the following license:
     *   Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
     *   View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
     *
     * @author Nabeel Shahzad
     * @copyright Copyright (c) 2008, Nabeel Shahzad
     * @link http://www.phpvms.net
     * @license http://creativecommons.org/licenses/by-nc-sa/3.0/
    **/
    class Keys extends CodonModule {    
        public function index() {
            // Add your details here
            $username = 'username';
            $password = 'password';
            $serveradd = '100.1.58.158:10011';
            $serverport = '9987';
    		
            if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {
            	$group = "Server Admin";
            } else if(PilotGroups::group_has_perm(Auth::$usergroups, EDIT_NEWS)) {
                $group = "Instructor";
            } else if(PilotGroups::group_has_perm(Auth::$usergroups, EDIT_PILOTS)) {
                $group = "Hub Manager";
            } else {
                $group = "BVA Pilot";
            }
    
            // load framework files
            require_once(SITE_ROOT."core/modules/Keys/lib/Teamspeak3.php");
            // connect to local server, authenticate and spawn an object for the virtual server on port 9987
            $ts3_VirtualServer = TeamSpeak3::factory("serverquery://{$username}:{$password}@{$serveradd}/?server_port={$serverport}");
    	// spawn an object for the group using a specified name
            $arr_ServerGroup = $ts3_VirtualServer->serverGroupGetByName($group);
            // create the privilege key
            $ts3_PrivilegeKey = $arr_ServerGroup->privilegeKeyCreate();
            
            if($group !== ""){
                $this->set('key', $ts3_PriviledgeKey);
                $this->show('key_generated');
                return;
            } else {
                $this->set('message','Key unable to be generated. Try again later.');
                $this->show('core_error');
                return;
            }
        }
    }

     

     

     

     
     

    Same result...  Unfortunately, I can find no support area from the developer.  Everything online seems to be leaning toward "open your ports", something that's already been done.  Will leave this discussion here.  Thanks for the help.

  2. Looked online for some solutions...  Best I could come up with was a firewall issue?  I've forwarded the appropriate port for server query, 10011, and added the website's IP to the whitelist.   Tools like TSViewer.com work fine, but they're written (I believe) using node-teamspeak, and not this PHP library.  Is it a more viable plan to try and switch over to node-teamspeak? 

  3. Your image isn't appearing...

     

    Have you gone through /public_html/admin/templates/core_navigation.tpl and checked the links for their proper admin modules? 

    <li><a href="<?php echo adminurl('/downloads/overview'); ?>">Downloads</a></li>

    It should be noted that "adminurl" needs to be there, rather than "url" like it is in navigation.tpl.

  4. 18 minutes ago, Nabeel said:

    use SITE_ROOT to build the path to it. The way it is now, it's relative to the caller

    Solved with:

    define('SITE_ROOT','/public_html/');
    
    require_once(SITE_ROOT . "/core/modules/Keys/ts3phpframework-master/libraries/TeamSpeak3/TeamSpeak3.php");

    Now resulting in the following error, still HTTP 500: 

    [03-Aug-2017 16:51:35 Europe/London] PHP Fatal error:  Uncaught exception 'TeamSpeak3_Transport_Exception' with message 'Connection refused' in /home/britishvirginatl/public_html/core/modules/Keys/ts3phpframework-master/libraries/TeamSpeak3/Transport/TCP.php:54
    Stack trace:
    #0 /home/britishvirginatl/public_html/core/modules/Keys/ts3phpframework-master/libraries/TeamSpeak3/Transport/TCP.php(108): TeamSpeak3_Transport_TCP->connect()
    #1 /home/britishvirginatl/public_html/core/modules/Keys/ts3phpframework-master/libraries/TeamSpeak3/Adapter/ServerQuery.php(76): TeamSpeak3_Transport_TCP->readLine()
    #2 /home/britishvirginatl/public_html/core/modules/Keys/ts3phpframework-master/libraries/TeamSpeak3/Adapter/Abstract.php(60): TeamSpeak3_Adapter_ServerQuery->syn()
    #3 /home/britishvirginatl/public_html/core/modules/Keys/ts3phpframework-master/libraries/TeamSpeak3/TeamSpeak3.php(322): TeamSpeak3_Adapter_Abstract->__construct(Array)
    #4 /home/britishvirginatl/public_html/core/modules/Keys/Keys.php(41): TeamSpeak3::factory('serverquery://s...')
    #5 [internal function]: Keys->ind in /home/britishvirginatl/public_html/core/modules/Keys/ts3phpframework-master/libraries/TeamSpeak3/Transport/TCP.php on line 54

    This should isolate it to this line:

    // connect to local server, authenticate and spawn an object for the virtual server on port 9987
    $ts3_VirtualServer = TeamSpeak3::factory("serverquery://serveradmin:password@100.1.58.158:10011/?server_port=9987");

    However, this is exactly how the documentation's examples specify how to use it. (See example #5)

     

    Thoughts?  Broken API or am I doing something wrong?  See my most recent code here.

     

  5. 55 minutes ago, Nabeel said:

    Have you looked in your server's error/access logs? That's the only way you'll really be able to find the error. Unless you wrap the entire thing in an exception and then trap/print it out.

    Looking through the error files, I found a few typos and other errors on my part, which I've since fixed.  I can't seem to get rid of the following error, however:

    [03-Aug-2017 16:29:24 Europe/London] PHP Warning:  require_once(/public_html/core/modules/Keys/ts3phpframework-master/libraries/TeamSpeak3/TeamSpeak3.php): failed to open stream: No such file or directory in /home/britishvirginatl/public_html/core/modules/Keys/Keys.php on line 38
    [03-Aug-2017 16:29:24 Europe/London] PHP Fatal error:  require_once(): Failed opening required '/public_html/core/modules/Keys/ts3phpframework-master/libraries/TeamSpeak3/TeamSpeak3.php' (include_path='.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php') in /home/britishvirginatl/public_html/core/modules/Keys/Keys.php on line 38

     

    This isolates the issue to this line:

    // load framework files
    require_once("ts3phpframework-master/libraries/TeamSpeak3/TeamSpeak3.php");

     

    Assuming that ts3phpframework-master and all the appropriate subfiles are in the same directory as Keys.php (/public_html/core/modules/Keys), what would I make the file path to remove this error?

  6. phpVMS creators,

     

    In my efforts to create a system that generates TeamSpeak Privilege keys, I decided that the best way to do it was to create a new core module.  I've written all the necessary code, and uploaded it to the server, but when I select the page in the navigation bar, it comes back with an HTTP Error 500.  I've looked through the code, and haven't found any reason why this would be happening.  

     

    Keys.php

    <?php
    /**
     * phpVMS - Virtual Airline Administration Software
     * Copyright (c) 2008 Nabeel Shahzad
     * For more information, visit www.phpvms.net
     *	Forums: http://www.phpvms.net/forum
     *	Documentation: http://www.phpvms.net/docs
     *
     * phpVMS is licenced under the following license:
     *   Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
     *   View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
     *
     * @author Nabeel Shahzad
     * @copyright Copyright (c) 2008, Nabeel Shahzad
     * @link http://www.phpvms.net
     * @license http://creativecommons.org/licenses/by-nc-sa/3.0/
     */
    class Keys extends CodonModule{
        
        public function index(){
            if(PilotGroups::groups_has_perm(Auth::$usergroups, ACCESS_ADMIN))
            {
                $group = "Server Admin";
            }else if(PilotGroups::groups_has_perm(Auth::$usergroups, EDIT_NEWS))
            {
                $group = "Instructor";
            }else if(PilotGroups::groups_has_perm(Auth::$usergroups, EDIT_PILOTS)){
                $group = "Hub Manager";
            }else{
                $group = "BVA Pilot";
            }
            
            
            // load framework files
            require_once("britishvirginatlantic.co.uk/lib/ts3phpframework-master/libraries/TeamSpeak3/TeamSpeak3.php");
            // connect to local server, authenticate and spawn an object for the virtual server on port 9987
            $ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:password@100.1.58.158:10011/?server_port=9987");
            // spawn an object for the group using a specified name
            $arr_ServerGroup = $ts3_VirtualServer->serverGroupGetByName($group);
            // create the privilege key
            $ts3_PrivilegeKey = $arr_ServerGroup->privilegeKeyCreate();
            return $ts3_PriviledgeKey;
            
            if($group!=""){
                $this->set('key', genKey());
                $this->render('key_generated.tpl');
                return;
            }else{
                $this->set('message','Key unable to be generated.  Try again later.');
                $this->render('core_error.tpl');
                return;
            }
        }
    }
    
    ?>

     

    key_generated.tpl

    <p>Your Key:</p>
    <p><?php echo $key ?></p>

    Any ideas as to why this causes an HTTP error, and how I could fix it?  Thanks.

×
×
  • Create New...