ownerrek1992
Member
- Jan 11, 2016
- 8
- 0
- 33
Hello, I have a problem with the bot TeamSpeak 3 , namely checking channels command ! Check . Sets date to me :
http://scr.hu/0w2hq/l8av8 and I would to take date NORMAL example ; 26/06/2016 . Thank you for your help
and sorry for my english .
http://scr.hu/0w2hq/l8av8 and I would to take date NORMAL example ; 26/06/2016 . Thank you for your help
PHP:
<?php
/***************************
Function: Channel Checker
***************************/
require_once 'config/teamspeak.php';
require_once 'include/ts3admin.class.php';
function channelchecker()
{
global $config;
global $query;
global $number;
global $main;
global $mainclients;
global $maintopic;
$channel = $query->getElement('data', $query->channelList('-topic -limits'));
foreach($channel as $channels)
{
if($channels['pid'] == $config['channelchecker']['pid']) //sprawdza strefe kanalow
{
$main = $channels['cid'];
$mainclients = $channels['total_clients'];
$maintopic = $channels['channel_topic'];
//jezeli na kanale jest wiecej niz jedna osoba wtedy do topicu dopisuje dzisjejsza date + ustalony czas
if($channels['total_clients']!=0)
{
$timestamp = time();
$expiredate = strtotime("+7 days",$timestamp);
//$expiredate = date("d.m.y,H:i:s", strtotime('+15 minutes')); //Tutaj ustawiamy o ile ma przedluzac kanał
$data = array();
$data['channel_topic'] = $expiredate;
$query->channelEdit($channels['cid'], $data);
}
//jezeli na kanale jest 0 osob porownuje date z topicu do dzisjejszej i ustala czy blokowac kanał czy nie
if($channels['total_clients']==0)
{
if($channels['channel_topic']=='') //jezeli topic jest pusty
{
$timestamp = time();
$expiredate = strtotime("+1 days",$timestamp);
//$expiredate = date("d.m.y,H:i:s", strtotime('+1 minutes')); //Tutaj ustawiamy o ile ma przedluzac kanał
$data = array();
$data['channel_topic'] = $expiredate;
$query->channelEdit($channels['cid'], $data);
}
$number = (integer)$channels['channel_name']; //pobiera numer kanalu
$date = $channels['channel_topic']; //pobiera date z topicu
$date1 = strtotime($date);
//echo $date;
$todaydate = time();
//echo date("d.m.y,H:i:s", (int)$date);
//echo date("d.m.y,H:i:s", $date1);
//echo date("d.m.y,H:i:s", strtotime($channels['channel_topic']));
if($todaydate > (int)$date && $channels['channel_topic']!='') //porownuje daty
{
$data = array();
$data['channel_name'] = ''.$number.'. Kanał zablokowany'; //zmien nazwe kanalu na zablkowowany
$data['channel_maxclients'] = 0; //ustaw maxclients na 0
$data['channel_maxfamilyclients'] = 0; //ustaw maxfamilyclients na 0
$query->channelEdit($channels['cid'], $data);
}
}
}
if($channels['pid'] == $main) //sprawdza strefe kanalow
{
// echo $channels['pid'];
//jezeli na kanale jest wiecej niz jedna osoba wtedy do topicu dopisuje dzisjejsza date + ustalony czas
if($channels['total_clients']!=0)
{
$timestamp = time();
$expiredate = strtotime("+7 days",$timestamp);
//$expiredate = date("d.m.y,H:i:s", strtotime('+7 days')); //Tutaj ustawiamy o ile ma przedluzac kanał
$data = array();
$data['channel_topic'] = $expiredate;
$query->channelEdit($main, $data);
}
if($mainclients==0)
{
//$number = (integer)$channels['channel_name']; //pobiera numer kanalu
$date = $maintopic; //pobiera date z topicu
$date1 = strtotime($date);
$todaydate = time();
if($todaydate > (int)$date && $maintopic!='') //porownuje daty
{
$query->channelDelete($channels['cid']);
}
}
}
}
unset($config);
unset($query);
unset($number);
unset($main);
unset($mainclients);
unset($maintopic);
}
?>