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

Results 1 to 7 of 7
  1. #1
    Join Date
    July 2014
    Posts
    38

    Request simple php page

    Hello everyone. Im asking just one simple php page, but since I dont know any php ts3 framework I ask you.

    Here is what I need.

    I need it to look like simple form with 3 lines :
    ServerGroupID (thats my template that will be used to make copy of it and name will be set in second line)
    ServerGroupName (that will be name of copied servergroup)
    ChannelID (this will be used for uploading txt file I will explain)

    So first of all I enter all these three values when I enter submit I need script to do:

    Make copy servergroup from template which was desired by servergroup ID in first line, set it name to what was desired in second line.
    Make 50 privilege keys for that new servergroup and save it into tokens.txt file (one token per line).
    That tokens.txt needs to be sent into channelID desired in last line.


    Feel free to ask questions.


    Im making it for my NPL Teamspeak which Im hosting for free. Im paying VPS. ITs totally free. I would be grateful to see it from you free to but I can pay 10USD. Thanks and have a nice day.

  2. #2
    Join Date
    February 2014
    Posts
    293
    If you don't know how to do it, why not learn yourself?

  3. #3
    Join Date
    July 2014
    Posts
    38
    Why so offtopic answer? I exactly typed Im looking for someone who can do it for free or for money. I dont want any offtopic answers....

  4. #4
    Join Date
    February 2014
    Posts
    293
    Quote Originally Posted by lukasjanra View Post
    Why so offtopic answer? I exactly typed Im looking for someone who can do it for free or for money. I dont want any offtopic answers....
    1. It's not off-topic at all, I'm suggesting you learn to do stuff like this yourself so you can familiarise yourself with the TS3 PHP Api.

    I learnt myself and it's much better as I can create stuff for ideas that I come up with.

    2. It will work out cheaper if you have more ideas.

    3. You can make this easily enough if you just learn, it's really not that hard.

  5. #5
    Join Date
    July 2014
    Posts
    38
    If its not that hard can you make it? If xou say so.

  6. #6
    Join Date
    February 2014
    Posts
    293
    Quote Originally Posted by lukasjanra View Post
    If its not that hard can you make it? If xou say so.
    Why would I make it for you when I've just suggested you learn to do so yourself?

  7. #7
    Join Date
    April 2015
    Posts
    12

    Solved The Solution v.1

    Are you all not thinking this is a bit kidding ? xD

    here you got the code

    My index.php (its not beautiful, but i think you will add this to your cms... so who cares )
    Code:
    <html>
    	<head>
    		<script language="JavaScript" src="jquery.js"></script>
    	
    		<script>
    			$(function() {
    				$('#create')
    					.click(function()
    					{
    						var ServerID		=	$('#ServerID').val();
    						var ServerGroupID	=	$('#ServerGroupID').val();
    						var ServerGroupName	=	$('#ServerGroupName').val();
    						var ChannelID		=	$('#ChannelID').val();
    						
    						var dataString = 'ServerGroupID='+ServerGroupID+'&ServerGroupName='+ServerGroupName+'&ChannelID='+ChannelID+'&ServerID='+ServerID;
    						$.ajax({
    							type: "POST",
    							url: "function.php",
    							data: dataString,
    							dataTyp: "json",
    							cache: false,
    							success: function(data)
    							{
    								alert(data);
    							}
    						});
    					})
    			})
    		</script>
    	</head>
    
    	<body>
    		ServerID: <input id="ServerID"></input><br />
    		ServerGroupID: <input id="ServerGroupID"></input><br />
    		ServerGroupName: <input id="ServerGroupName"></input><br />
    		ChannelID: <input id="ChannelID"></input><br />
    		<button id="create">Erstellen</button>
    	</body>
    </html>
    and the functions.php:
    Code:
    <?php
    	/*
    		---------------------------------------------------------------------------------
    		*********************************************************************************
    		*********************************************************************************
    		******************** //\\ (c) by WhIte DeAth aKa NiTroX //\\ ********************
    		*********************************************************************************
    		*********************************************************************************
    		---------------------------------------------------------------------------------
    		*********************************************************************************
    		*********************************************************************************
    		********************** //\\ Helpscript for lukasjanra //\\ **********************
    		*********************************************************************************
    		*********************************************************************************
    		---------------------------------------------------------------------------------
    	*/
    	
    	if((!isSet($_POST['ServerGroupID']) || $_POST['ServerGroupID'] == '')  || (!isSet($_POST['ServerGroupName']) || $_POST['ServerGroupName'] == '') || (!isSet($_POST['ChannelID']) || $_POST['ChannelID'] == '') || (!isSet($_POST['ServerID']) || $_POST['ServerID'] == ''))
    	{
    		echo "Error! Missing Parameters!!";
    	}
    	else
    	{
    		require_once("ts3admin.class.php");
    		
    		$ts3_server['ip']			= 'MyIP';
    		$ts3_server['queryport']	= 10011;
    		$ts3_server['user']			= 'serveradmin';
    		$ts3_server['pw'] 			= '***';
    		
    		$tsAdmin 			= 	new ts3admin($ts3_server['ip'], $ts3_server['queryport']);
    		
    		if($tsAdmin->getElement('success', $tsAdmin->connect()))
    		{
    			$tsAdmin->login($ts3_server['user'], $ts3_server['pw']);
    			
    			$selectserver = $tsAdmin->selectServer($_POST['ServerID'], 'serverId', true);
    			
    			if($selectserver['data'])
    			{
    				$serverGroupAdd		=	$tsAdmin->serverGroupAdd($_POST['ServerGroupName'], 1);
    				if($serverGroupAdd['success']===false)
    				{
    					for($i=0; $i+1==count($serverGroupAdd['errors']); $i++)
    					{
    						echo $serverGroupAdd['errors'][$i];
    					}
    				}
    				else
    				{
    					$serverGroupCopy	=	$tsAdmin->serverGroupCopy($_POST['ServerGroupID'], $serverGroupAdd['data']['sgid'], $_POST['ServerGroupName'], 1);
    					if($serverGroupCopy['success']===false)
    					{
    						for($i=0; $i+1==count($serverGroupCopy['errors']); $i++)
    						{
    							echo $serverGroupCopy['errors'][$i];
    						}
    					}
    					else
    					{
    						file_put_contents("token.txt", "");
    						
    						for($i = 0; $i < 50; $i++)
    						{
    							$token_add	=	$tsAdmin->tokenAdd(0, $serverGroupAdd['data']['sgid'], 0, 'Automatic Create Toeken');
    							
    							if($token_add['success'] !== false)
    							{
    								$file					=	file("token.txt");
    								$new_file				=	array();
    								
    								for ($zeile = 0;$zeile < count($file);$zeile++)
    								{
    									$new_file[$zeile]	=	$file[$zeile];
    								}
    								
    								//$new_zeile				=	$zeile - 1;
    								$new_file[$new_zeile]	=	"Token " . ($i+1) . ": " . $token_add['data']['token'] . "\n"; $zeile++;
    								
    								file_put_contents("token.txt", "");
    								file_put_contents("token.txt", $new_file);
    							}
    						}
    						
    						$uploadFile	=	$tsAdmin->ftInitUpload('/token.txt', $_POST['ChannelID'], filesize('token.txt'), '');
    						
    						$_file		= 	file_get_contents("token.txt");
    						$_upload	= 	$tsAdmin->ftUploadFile($uploadFile['data'], $_file);
    						
    						// PlanB
    						/*$_file		=	file_get_contents("token.txt");
    						$con_ft		=	fsockopen($ts3_server['ip'], '8888', $errnum, $errstr, 10);
    						fputs($con_ft, $uploadFile['data']['ftkey']);
    						fputs($con_ft, $_file);
    						fclose($con_ft);*/
    						
    						if($_upload['success'] !== false)
    						{
    							echo "Successfull ;)";
    						}
    						else
    						{
    							for($i=0; $i+1==count($_upload['errors']); $i++)
    							{
    								echo $_upload['errors'][$i];
    							}
    						}
    					}
    				}
    			}
    			else
    			{
    				echo "ServerID can not be found on this Instanz!";
    			}
    			
    			$tsAdmin->logout();
    		}
    	}
    ?>
    I have used the ts3admin.class, jQuery(just for the Post command) so pls include them too.

    But if you dont know what i mean here all in a .zip file

    And that money ?? buy some chochlate it looks like you are angry :P
    Attached Files Attached Files
    Last edited by lgund; December 27th, 2015 at 03:31 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [request] Addons site down, any simple soundboard mirrors?
    By Fuglypump in forum Client Plugins / Lua Scripts
    Replies: 2
    Last Post: January 3rd, 2014, 11:15 PM
  2. [Request] Simple DSP Plugin
    By Osmobot in forum Client Plugins / Lua Scripts
    Replies: 3
    Last Post: May 1st, 2012, 04:22 AM
  3. Simple request
    By Ratso in forum Skins / Icon & Sound Packs
    Replies: 2
    Last Post: December 30th, 2011, 12:45 AM
  4. [Request] - Simple registration bot
    By Tearlow in forum Client Plugins / Lua Scripts
    Replies: 2
    Last Post: July 15th, 2011, 05:01 PM

Posting Permissions

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