pipeter21
Active Member
- Jul 5, 2017
- 15
- 3
- 93
Hello everyone, I need help with the script to create channels. This script has a limit of creation per channel which is 10 seconds, but I need not be 10 seconds, I want to create a channel when a user can not create more until the channel is deleted!
sorry my bad english
this is my script to talk:
sorry my bad english
this is my script to talk:
PHP:
<?php session_start(); ?>
<?php
if(!isset($_SESSION['ts3_last_query']))
$_SESSION['ts3_last_query'] = microtime(true);
date_default_timezone_set('America/Santiago'); //Change Here!
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
include 'data/config.php';
function getClientIp() {
if (!empty($_SERVER['HTTP_CLIENT_IP']))
return $_SERVER['HTTP_CLIENT_IP'];
else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
return $_SERVER['HTTP_X_FORWARDED_FOR'];
else if(!empty($_SERVER['HTTP_X_FORWARDED']))
return $_SERVER['HTTP_X_FORWARDED'];
else if(!empty($_SERVER['HTTP_FORWARDED_FOR']))
return $_SERVER['HTTP_FORWARDED_FOR'];
else if(!empty($_SERVER['HTTP_FORWARDED']))
return $_SERVER['HTTP_FORWARDED'];
else if(!empty($_SERVER['REMOTE_ADDR']))
return $_SERVER['REMOTE_ADDR'];
else
return false;
}
$connect = "serverquery://".$USER_QUERY.":".$PASS_QUERY."@".$HOST_QUERY.":".$PORT_QUERY."/?server_port=".$SERVER_PORT."";
$ts3 = TeamSpeak3::factory($connect);
$ts3->execute("clientupdate", array("client_nickname" => $NICK_QUERY));
$FLAG = false;
foreach ($ts3->clientList(array('client_type' => '0', 'connection_client_ip' => getClientIp())) as $client) {
$clientuid = $client->client_unique_identifier;
$client_nickname = $client->client_nickname;
$client_clid = $client->clid;
$FLAG = true;
break;
}
if (!$FLAG){
echo "<p><b>".$lang['f_connectts'].".</b></p><br/>";
}
if (isset($_POST["create"])) {
$channelname = $_POST['channelname'];
$subchannelname = $_POST['subchannelname'];
$subchannelname2 = $_POST['subchannelname2'];
$password = $_POST['password'];
$unixTime = time();
$realTime = date('[d-m-Y]-[H:i]',$unixTime);
$channel_admin_group = 9;
try
{
$cid1 = $ts3->channelCreate(array(
"channel_name" => "$channelname",
"channel_password" => "$password",
"channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
"channel_flag_permanent" => "1",
"channel_description" => '[center][b][u]'.$channelname.'[/u][/b][/center][hr][b][list][*]Creado: '.$realTime.'[*]Dueño del canal: [color=red] ' .$client_nickname. ' [/color][/list][/b]',
"cpid" => $cid,
"channel_order" => "$order"
));
$sub_cid = $ts3->channelCreate(array(
"channel_name" => "$subchannelname",
"channel_password" => "$password",
"channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
"channel_flag_permanent" => TRUE,
"channel_description" => '[b][*] Dueño del canal: [color=red] ' .$client_nickname. ' [/color][/b]',
"cpid" => $cid1,
));
$sub_cid = $ts3->channelCreate(array(
"channel_name" => "$subchannelname2",
"channel_password" => "$password",
"channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
"channel_flag_permanent" => TRUE,
"channel_description" => '[b][*] Dueño del canal: [color=red] ' .$client_nickname. ' [/color][/b]',
"cpid" => $cid1,
));
$ts3->clientGetByUid($clientuid)->setChannelGroup($cid1, $channel_admin_group);
$ts3->clientMove($client_clid, $cid1);
}
catch(Exception $e)
{
echo "Error (ID " . $e->getCode() . ") <b>" . $e->getMessage() . "</b>";
}
}
?>
Last edited: