Resource icon

Automatic Banner 1.0

No permission to download

Pain

Member
Feb 20, 2016
102
17
53
php-gd installed?
You only have to start ./run start
Still not working

4v7cYnJ.png


Code:
<?php
set_time_limit(0);
date_default_timezone_set("Europe/Warsaw");
header('Content-Type: image/png');

$config = array (
            'VIP' => '40',
            'S-VIP' => '39',
            'CEO' => '9',
            'ROOT' => '10',
            'SSA' => '13'
        );
//GETTING CACHE
$cache = file_get_contents('cache.ss');
$cache = json_decode($cache, true);

$clients = $cache['clients'];

$serverGroups = $cache['groups'];

$online = $cache['server']['virtualserver_clientsonline'] - $cache['server']['virtualserver_queryclientsonline'];

$channelcounter = $cache['server']['virtualserver_channelsonline'];

$clientconnections = $cache['server']['virtualserver_client_connections'];

$slots = $cache['server']['virtualserver_maxclients'];

$secs = $cache['server']['virtualserver_uptime'];
$now = date_create('now', new DateTimeZone('GMT'));
$here = clone $now;
$here->modify($secs.' seconds');
$diff = $now->diff($here);
$uptime = $diff->format('%a D %h H %i M %s S');

///////ADMINS COUNTER
//CEOs counter
$client = $cache['clients'];
        $CEOs = 0;
        foreach($client as $target) {
        $sgtarget = explode(',', $target['client_servergroups']);
        if(in_array($config['CEO'], $sgtarget)) { $CEOs++; }
        }
//ROOTs counter
$client = $cache['clients'];
        $ROOTs = 0;
        foreach($client as $target) {
        $sgtarget = explode(',', $target['client_servergroups']);
        if(in_array($config['ROOT'], $sgtarget)) { $ROOTs++; }
        }     
//SSAs counter
$client = $cache['clients'];
        $SSAs = 0;
        foreach($client as $target) {
        $sgtarget = explode(',', $target['client_servergroups']);
        if(in_array($config['SSA'], $sgtarget)) { $SSAs++; }
        } 

///////SPECIAL GROUPS COUNTER 
$client = $cache['clients'];
        $VIPs = 0;
        foreach($client as $target) {
        $sgtarget = explode(',', $target['client_servergroups']);
        if(in_array($config['VIP'], $sgtarget)) { $VIPs++; }
        }
$client = $cache['clients'];
        $SVIPs = 0;
        foreach($client as $target) {
        $sgtarget = explode(',', $target['client_servergroups']);
        if(in_array($config['S-VIP'], $sgtarget)) { $SVIPs++; }
        }     
 
//BANNER GENERATING
$time = date("H:i");
$date = date("d.m.y");
$fbebas = 'resources/fonts/bebas.ttf';
$img = imagecreatefrompng("resources/img/bg.png");



$adminscounter = $CEOs + $ROOTs + $SSAs;
$vipscounter = $VIPs + $SVIPs;

$color = array(
            'white' => imagecolorallocate($img, 255, 255, 255),
            'green' => imagecolorallocate($img, 0, 255, 0),
            'red' => imagecolorallocate($img, 255, 0, 0)
        );

        imagettftext($img, 70, 0, 530, 380, $color['white'], $fbebas, $time. ' | ' .$date);     
     
        imagettftext($img, 40, 0, 480, 620, $color['white'], $fbebas, 'Random news about server');
     
        imagettftext($img, 50, 0, 90, 295, $color['white'], $fbebas, $online. '/' .$slots);

        imagettftext($img, 50, 0, 1380, 285, $color['white'], $fbebas, $channelcounter);
     
        imagettftext($img, 45, 0, 430, 870, $color['white'], $fbebas, 'Server uptime:' .$uptime);
     
        if($socket = @fsockopen('localhost', 10011, $errno, $errstr, 2)) {
            imagettftext($img, 50, 0, 80, 690, $color['green'], $fbebas, Online);
        } 
        else {
            imagettftext($img, 50, 0, 80, 690, $color['red'], $fbebas, Offline);
        }
     
        imagettftext($img, 50, 0, 125, 495, $color['white'], $fbebas, $clientconnections);
     
        imagettftext($img, 50, 0, 1400, 495, $color['white'], $fbebas, $adminscounter);
     
        imagettftext($img, 50, 0, 1400, 690, $color['white'], $fbebas, $vipscounter);

imagepng($img, '/var/www/banner.png');
imagedestroy($img);

?>


how can I solve this problem please help me

teamspeak 3: -IP REMOVED-

Edited BY MOD QRAKTZYL
Please do not post your ip here. If you want to invite people for help, join the r4p3 forums.
 
Last edited by a moderator:
M

Member 2873

PHP Notice: Use of undefined constant Offline - assumed 'Offline' in /home/banner/banner.php on line 104
Upon manually starting it, no message when doing ./run start
 

atrox

Member
Jan 3, 2016
4
0
33
PHP Notice: Use of undefined constant Offline - assumed 'Offline' in /home/banner/banner.php on line 104
Upon manually starting it, no message when doing ./run start
Change the banner.php to the following to remove those errors:
Code:
if ($socket = @fsockopen('YOUR_TS_SERVER_IP_HERE', YOUR_TS_QUERY_PORT_HERE, $errno, $errstr, 2)) {
    imagettftext($img, 50, 0, 80, 690, $color['green'], $fbebas, "Online");
} else {
    imagettftext($img, 50, 0, 80, 690, $color['red'], $fbebas, "Offline");
}
Note the " for Offline and Online.
 

0x0539

Retired Staff
Contributor
Jan 30, 2016
1,334
1,146
254
Change the banner.php to the following to remove those errors:
Code:
if ($socket = @fsockopen('YOUR_TS_SERVER_IP_HERE', YOUR_TS_QUERY_PORT_HERE, $errno, $errstr, 2)) {
    imagettftext($img, 50, 0, 80, 690, $color['green'], $fbebas, "Online");
} else {
    imagettftext($img, 50, 0, 80, 690, $color['red'], $fbebas, "Offline");
}
Note the " for Offline and Online.
You could just change the words "red" to "green" and "offline" to "online" since it doesn't matter.. at all, if your server is offline the banner won't show up anyway, there's no need for the offline function. (I suppose you use this banner on TS3 & not website).
 

atrox

Member
Jan 3, 2016
4
0
33
You could just change the words "red" to "green" and "offline" to "online" since it doesn't matter.. at all, if your server is offline the banner won't show up anyway, there's no need for the offline function. (I suppose you use this banner on TS3 & not website).
This Banner is for a website. Does not make sense to show this in the Teamspeak itself.
 

0x0539

Retired Staff
Contributor
Jan 30, 2016
1,334
1,146
254
This Banner is for a website. Does not make sense to show this in the Teamspeak itself.
Doesn't need to be for the website, what I meant is that it has a perfect resolution to be used as TS3 banner.
Without the status function it won't be too stupid to use it as TS3 banner
 

atrox

Member
Jan 3, 2016
4
0
33
Doesn't need to be for the website, what I meant is that it has a perfect resolution to be used as TS3 banner.
Without the status function it won't be too stupid to use it as TS3 banner
Why would I want to show the current users etc, in Teamspeak itself? They can just take a look at the data listed in teamspeak itself...
I currently use a customized version myself, I show the banner on my website and as host banner I show a smaller banner, with just the news on it.
 

0x0539

Retired Staff
Contributor
Jan 30, 2016
1,334
1,146
254
Why would I want to show the current users etc, in Teamspeak itself? They can just take a look at the data listed in teamspeak itself...
I currently use a customized version myself, I show the banner on my website and as host banner I show a smaller banner, with just the news on it.
Hmm, that question can be made to anything.. -> "Why would I want to show the current users etc, in Teamspeak itself?"
Why would someone want a Timebot on their TS3 server?
Why would someone want a ClientsOnline on their TS3 server?
Why would someone want a StaffOnline on their TS3 server?
Pretty much every query/bot release...
vcryoi.png

While all of these information can be seen in the server information.
And about the timebot? Have you heard of your clock in the right bottom corner?
 

atrox

Member
Jan 3, 2016
4
0
33
Hmm, that question can be made to anything.. -> "Why would I want to show the current users etc, in Teamspeak itself?"
Why would someone want a Timebot on their TS3 server?
Why would someone want a ClientsOnline on their TS3 server?
Why would someone want a StaffOnline on their TS3 server?
vcryoi.png

While all of these information can be seen in the server information.
And about the timebot? Have you heard of your clock in the right bottom corner?
xD, Yeah. I never understood why someone would use that.
Does not make sense to me. Eventually the "Staff Online" section on the clock COULD be useful, but the rest is total irrelevant.
 

Pain

Member
Feb 20, 2016
102
17
53
Hmm, that question can be made to anything.. -> "Why would I want to show the current users etc, in Teamspeak itself?"
Why would someone want a Timebot on their TS3 server?
Why would someone want a ClientsOnline on their TS3 server?
Why would someone want a StaffOnline on their TS3 server?
Pretty much every query/bot release...
vcryoi.png

While all of these information can be seen in the server information.
And about the timebot? Have you heard of your clock in the right bottom corner?


Whether or not these things apart
My server to the other

This can be a way for me to sell my product and win over simple things like that, I can say that there are few servers that have this system, the customer will find super cool and will take an interest in our new products!
 

Pegas

Member
Oct 29, 2015
23
25
51
If somebody is intrested in graphic so u can do project of banner for me please :) 1600x600
 

ALIVE

VIP
Feb 8, 2016
35
15
83
You can also use a cronjob for the updates.
*/1 * * * * cd /home/banner/ ; /usr/bin/php cache.php ; /usr/bin/php banner.php
 
Last edited:

thespeedy

Member
Jan 16, 2016
24
1
35
PHP Warning: DateTime::modify(): Failed to parse time string ( seconds) at position 0 (s): The timezone could not be found in the database in /home/banner/banner.php on line 32
PHP Warning: Invalid argument supplied for foreach() in /home/banner/banner.php on line 40
PHP Warning: Invalid argument supplied for foreach() in /home/banner/banner.php on line 47
PHP Warning: Invalid argument supplied for foreach() in /home/banner/banner.php on line 54
PHP Warning: Invalid argument supplied for foreach() in /home/banner/banner.php on line 62
PHP Warning: Invalid argument supplied for foreach() in /home/banner/banner.php on line 68
 
Top