首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DatabaseID的昵称

DatabaseID的昵称
EN

Stack Overflow用户
提问于 2017-07-08 02:46:56
回答 1查看 105关注 0票数 0

我开始使用planetteamspeak.com的TeamSpeak 3PHP框架。我不明白添加和删除客户端的Servergroup。它总是告诉我"invalid ClientID“,这意味着我遗漏了一些东西。

我试了很多方法来获取身份证,但是都不起作用。如果我能通过clientname得到ID就好了,但是我不知道怎么做。

手动输入也被称为“无效”。以下是我的代码:

代码语言:javascript
复制
<?php
require_once ("lib/TeamSpeak3/TeamSpeak3.php");
require_once ("config/config.php");

// goes into config later
date_default_timezone_set($config['timezone']);
// current time
$the_time = date('Y-m-d h:i a');
// setup connection
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://" . $config["Username"] . ":" . $config["Password"] . "@" . $config["IP"] . ":" . $config["qPort"] . "/?server_port=" . $config["Port"] . "&nickname=" . $config["Nickname"] . "");
// query clientlist from virtual server
$arr_clientList = $ts3_VirtualServer->ClientList();
// walk through list of clients
foreach($arr_clientList as $client) {
    if ($client["client_type"] == 1) {
        continue;
    }
    echo $client . " benutzt " . $client["client_platform"] . ".\n";
    // fetch first connection of specified client ^
    $client_created = date('Y-m-d h:i a', $client->client_created);
    echo $the_time . ' Uhr lokal. ';
    echo "\n";
    echo $client_created . ' Client erstellt. ';
    $to_time = strtotime($the_time);
    $from_time = strtotime($client_created);
    echo "\n";
    echo $client . " ist ";
    if (round(abs($to_time - $from_time) / 86400, 2) >= 30) {
        echo "Stammgast. ";
        try {
            $sgid = "7";
            $ts3_VirtualServer->serverGroupClientDel($sgid, '12');
        }
        catch(Exception $e) {
            echo $e->getMessage();
        }
        try {
            $sgid = "13";
            $ts3_VirtualServer->serverGroupClientAdd($sgid, '12');
        }
        catch(Exception $e) {
            echo $e->getMessage();
        }
    }
    else if (round(abs($to_time - $from_time) / 86400, 2) >= 14) {
        echo "Member. ";
        try {
            $sgid = "29";
            $ts3_VirtualServer->serverGroupClientDel($sgid, '12');
        }
        catch(Exception $e) {
            echo $e->getMessage();
        }
        try {
            $sgid = "7";
            $ts3_VirtualServer->serverGroupClientAdd($sgid, '12');
        }
        catch(Exception $e) {
            echo $e->getMessage();
        }
    }
    else if (round(abs($to_time - $from_time) / 86400, 2) >= 7) {
        echo "Rookie. ";
        try {
            $sgid = "29";
            $ts3_VirtualServer->clientGetByName($client)->serverGroupClientAdd($sgid, '12');
        }
        catch(Exception $e) {
            echo $e->getMessage();
        }
    }
    echo "\n";
    echo 'Erster connect war ' . round(abs($to_time - $from_time) / 86400, 2) . ' Tage früher. ';
    echo "\n\n";
}
?>

config.php:

代码语言:javascript
复制
<?php

$config = array(); //Creates Config Array
$config["Username"] = "serveradmin";
$config["Password"] = "**********";
$config["IP"] = "***********"; //Server IP/Domain
$config["Port"] = "9987"; //Server Port
$config["qPort"] = "10011"; // Query Port, Default 10011
$config["Nickname"] = rawurlencode("Rangsystem".rand(1, 99)); // Random number & Convertes Botname to a URI friendly Format
$config["timezone"] = 'Europe/Berlin';
?>
EN

回答 1

Stack Overflow用户

发布于 2017-07-08 05:42:23

我找到了我的问题

代码语言:javascript
复制
$ts3_VirtualServer->serverGroupClientDel($sgid, $client);

代码语言:javascript
复制
$ts3_VirtualServer->serverGroupClientDel($sgid, $client['client_database_id']);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44977761

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档