Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //--configuration--//
- $db_host = 'localhost';
- $db_name = 'ts3script';
- $db_username = 'root';
- $db_password = 'roswell';
- $server_name = 'Lafumisterie';
- //-----------------//
- function ts3info()
- {
- global $db_host, $db_name, $db_username, $db_password, $server_name;
- require_once("libraries/TeamSpeak3/TeamSpeak3.php");
- try {
- $ts3_VirtualServer = TeamSpeak3::factory("serverquery://serveradmin:Zwhyso0z@91.134.173.38:10011/?server_port=9987") ;
- $arr_ClientList = $ts3_VirtualServer->clientList(array("client_type" => ""));
- $server_status = $ts3_VirtualServer->virtualserver_status;
- $server_actuallyusers = $ts3_VirtualServer->virtualserver_clientsonline - $ts3_VirtualServer->virtualserver_queryclientsonline;
- $server_maxusers= $ts3_VirtualServer->virtualserver_maxclients;
- $conn = new mysqli($db_host, $db_username, $db_password, $db_name);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "DELETE FROM client";
- if ($conn->query($sql) === TRUE) {
- echo "status 0 successfully";
- } else {
- echo "Error updating record: " . $conn->error;
- }
- $sql = "UPDATE server SET servername = '$server_name', serverstatus = '$server_status', nombre_client = '$server_actuallyusers' WHERE id=1";
- if ($conn->query($sql) === TRUE) {
- echo "Record updated successfully";
- } else {
- echo "Error updating record: " . $conn->error;
- }
- foreach($arr_ClientList as $ts3_Client)
- {
- $conn->query("REPLACE INTO client (clientname) VALUES ('$ts3_Client')");
- }
- }
- catch(TeamSpeak3_Exception $e)
- {
- echo 'status : <font color="#FF0000">offline</font><br />';
- }
- $conn->close();
- }
- while (true) {
- ts3info();
- sleep(60);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement