how add date in my

radar

Member
Feb 18, 2016
4
0
36
Hello, how can I add the date to the time bot


<?php
/*
* ts3clock.php
*
* @category Teamspeak 3 Clock
* @author HellBz
* @copyright 2015 HellBz
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @link https://gist.github.com/HellBz/2414f4aebbbf28b59e06#file-ts3clock-php
*/

/*-------SETTINGS-------*/
$ts3_ip = '127.0.0.1'; // Serverport
$ts3_queryport = 10011; // Server-Queryport
$ts3_user = 'serveradmin'; // Admin-Username
$ts3_pass = '1234'; // Password
$ts3_nick = 'TimeBot'; // Nickname for Channelchange
$ts3_port = 9987; // Server-Port
$input = date('H : i'); // Input Numbers or Letters
$prefix = '[cspacer]'; //Prefix of Time-Line
$suffix = ''; //Suffix of Time-Line
/*----------------------*/
#Include ts3admin.class.php
require("ts3admin.class.php");
//Create Letter Array
$letters = array();
$l = $letters;
//Create Translation Array
$trans = array();
//Create Linearray and Empty Lines
$line = array();
$la = ''; $lb = ''; $lc = ''; $ld = ''; $cnt = 1;
//Config for Letters and Numbers & Translation
$l['0']['1'] = '█▀▀▀█─'; $l['1']['1'] = '▀█─'; $l['2']['1'] = '▀▀▀▀█─'; $l['3']['1'] = '▀▀▀▀█─'; $l['4']['1'] = '█───█─';
$l['0']['2'] = '█───█─'; $l['1']['2'] = '─█─'; $l['2']['2'] = '▄▄▄▄█─'; $l['3']['2'] = '─▄▄▄█─'; $l['4']['2'] = '█───█─';
$l['0']['3'] = '█───█─'; $l['1']['3'] = '─█─'; $l['2']['3'] = '█─────'; $l['3']['3'] = '────█─'; $l['4']['3'] = '▀▀▀▀█─';
$l['0']['4'] = '█▄▄▄█─'; $l['1']['4'] = '─█─'; $l['2']['4'] = '█▄▄▄▄─'; $l['3']['4'] = '▄▄▄▄█─'; $l['4']['4'] = '────█─';
$l['5']['1'] = '█▀▀▀▀─'; $l['6']['1'] = '█▀▀▀▀─'; $l['7']['1'] = '▀▀▀▀█─'; $l['8']['1'] = '█▀▀▀█─'; $l['9']['1'] = '█▀▀▀█─';
$l['5']['2'] = '█▄▄▄▄─'; $l['6']['2'] = '█▄▄▄▄─'; $l['7']['2'] = '────█─'; $l['8']['2'] = '█▄▄▄█─'; $l['9']['2'] = '█───█─';
$l['5']['3'] = '────█─'; $l['6']['3'] = '█───█─'; $l['7']['3'] = '────█─'; $l['8']['3'] = '█───█─'; $l['9']['3'] = '▀▀▀▀█─';
$l['5']['4'] = '▄▄▄▄█─'; $l['6']['4'] = '█▄▄▄█─'; $l['7']['4'] = '────█─'; $l['8']['4'] = '█▄▄▄█─'; $l['9']['4'] = '▄▄▄▄█─';
$l['sp']['1'] = '─'; $l['do']['1'] = '─'; $l['dd']['1'] = '─'; $l['ko']['1'] = '─'; $l['']['1'] = '';
$l['sp']['2'] = '─'; $l['do']['2'] = '─'; $l['dd']['2'] = '▀'; $l['ko']['2'] = '─'; $l['']['2'] = '';
$l['sp']['3'] = '─'; $l['do']['3'] = '─'; $l['dd']['3'] = '▀'; $l['ko']['3'] = '─'; $l['']['3'] = '';
$l['sp']['4'] = '─'; $l['do']['4'] = '▀'; $l['dd']['4'] = '─'; $l['ko']['4'] = '█'; $l['']['4'] = '';
$trans[' '] = 'sp'; $trans['.'] = 'do'; $trans[':'] = 'dd'; $trans[','] = 'ko';
//Split Wort in seperat Letters
$sletters = str_split($input);
foreach ( $sletters as $key => $val ) {
$getar = strtr($val, $trans);
$la .= $l[$getar]['1'];
$lb .= $l[$getar]['2'];
$lc .= $l[$getar]['3'];
$ld .= $l[$getar]['4'];

if ( $cnt < count($sletters) && $getar != 'sp' ){
$la .= $l['sp']['1'];
$lb .= $l['sp']['2'];
$lc .= $l['sp']['3'];
$ld .= $l['sp']['4'];
}
$cnt ++;
}

#Finish Lines
$line['1'] = $prefix.$la.$suffix;
$line['2'] = $prefix.$lb.$suffix;
$line['3'] = $prefix.$lc.$suffix;
$line['4'] = $prefix.$ld.$suffix;

#Login in Teamspeak
$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);

if($tsAdmin->getElement('success', $tsAdmin->connect())) {
#login as serveradmin
$tsAdmin->login($ts3_user, $ts3_pass);

#select teamspeakserver
$tsAdmin->selectServer($ts3_port);

#Set Nickname
$tsAdmin->setName($ts3_nick);

#Change Channels
$tsAdmin->channelEdit('31', array( 'channel_name' => $line['1'] ) );
$tsAdmin->channelEdit('32', array( 'channel_name' => $line['2'] ) );
$tsAdmin->channelEdit('33', array( 'channel_name' => $line['3'] ) );
$tsAdmin->channelEdit('34', array( 'channel_name' => $line['4'] ) );

#Logout of Teamspeak
$tsAdmin->logout();

echo 'Time on Channels was Set.';
}else{
echo 'Connection could not be established.';
}
?>
 
Top