Create channel web [help]

Discussion in 'PHP' started by qeekus, Feb 10, 2016.

  1. qeekus

    qeekus New Member

    AFGHAN likes this.
  2. Santiago

    Santiago New Member

    I recommend you leave the token in Base64, to avoid problems when put in the URL. :)
    To decode.
    PHP:
    $64decodetoken base64_decode($_GET["token"]);
    PHP:
    <?php
    require_once("libraries/TeamSpeak3/TeamSpeak3.php");
    /* Here it checks if the User has already created a room today. */
    if($_COOKIE["config623424123455"]==""){ /* If he has not created yet he goes and does the registration of the room */
    $ts3_VirtualServer TeamSpeak3::factory("serverquery://xxx:[email protected]:10011/?server_port=9987");
    // Channel Admin group ID goes here:
    $channel_admin_group 9;


    $name_channel         $_POST['nchannel'];
    $desc_channel         $_POST['dchannel'];
    $pass_channel         $_POST['pchannel'];

    // create a top-level channel and get its ID
    $top_cid $ts3_VirtualServer->channelCreate(array(
      
    "channel_name"           => "$name_channel",
      
    "channel_description"          => "$desc_channel",
      
    "channel_flag_permanent" => TRUE,
      
    "channel_password" => "$pass_channel",
    ));


       
    setcookie('config623424123455''1', (time() + (24 3600)));

       
    /* After he set up the room, it will add a record of 3 days,
       ie the User does not managed to create a new room for 3 days.
       Of course it will be able to circumvent it, clean up the records of the PC. */

    // Searches for the client. If exists, assign channel admin
    foreach($ts3_VirtualServer->clientList() as $client) {
        if(
    $_SERVER['REMOTE_ADDR'] == $client['connection_client_ip']) {
            
    $ts3_VirtualServer->clientGetById($client['clid'])->setChannelGroup($top_cid$channel_admin_group);
            
    $token $ts3_VirtualServer->channelGroupGetByName('GROUP NAME')->privilegeKeyCreate($top_cid'Token Auto - Desc');
            break;
        }
    }
    $
    64token base64_encode($token);
    header("Location: unit.php?op=1&token=$64token");
    }
    else
    {  
    /* If the User has created a room today, the system does not let him create another. Throwing you to the site with the initial error message. */
    header("Location: unit.php?op=2");
    }

    ?>
    :)
     
    Last edited: Feb 10, 2016
    Jackbox, AFGHAN, qeekus and 1 other person like this.
  3. qeekus

    qeekus New Member

    thx, well work
     
    Santiago and Jackbox like this.
  4. tiro

    tiro Member

    PHP:
    Parse errorsyntax errorunexpected '64' (T_LNUMBER), expecting variable (T_VARIABLE) or '$'
     

Share This Page