Guest User

Untitled

a guest
Jul 24th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.41 KB | None | 0 0
  1. <?php
  2. /*
  3.  Author: XARON
  4.  File: TeamSpeak3DynamicBanner: Main
  5.  Last Update: 05.06.2017 13:50
  6.  
  7. www.facebook.com/XARONNN
  8. */
  9. header('Content-type: image-png; charset=utf-8');
  10. error_reporting(E_ALL);
  11. require_once('ts3admin.class.php');
  12. require_once('TeamSpeak3/TeamSpeak3.php');
  13.  
  14. $ayarlar = array();
  15. $resimler = array();
  16. $ayarlar['host'] = 'localhost'; //Server IP (recommended localserver)
  17. $ayarlar['queryAdi'] = 'serveradmin'; //Query Name
  18. $ayarlar['querySifre'] = 'haslo'; //Query Password
  19. $ayarlar['queryPort'] = port; //Query Port
  20. $ayarlar['sunucuPort'] = 9986; //Server Port
  21. $ayarlar['botAdi'] = 'Banner'; //Bot Name
  22. $ayarlar['apiKey'] = 'klucz'; // "apixu.com" Api Key
  23. $ayarlar['dil'] = 'pl_PL.utf8'; // Language ("turkish", "english") etc..
  24. $ayarlar['ipApi'] = 'apixu'; // Api ("blazinglayer", "apixu") support ip api. (If blazinglayer api don't work, change to apixu.)
  25. $ayarlar['ipApiKey'] = 'free'; // Ip api key
  26. $resimler = ['tlo.png','tlo2.png']; // Background's
  27.  
  28. setlocale(LC_ALL, $ayarlar['dil']);
  29. $ts3Baglan = TeamSpeak3::factory('serverquery://'.$ayarlar['queryAdi'].':'.$ayarlar['querySifre'].'@'.$ayarlar['host'].':'.$ayarlar['queryPort'].'/?server_port='.$ayarlar['sunucuPort'].'&blocking=0&nickname='.urlencode($ayarlar['botAdi']));
  30. $clientListe = $ts3Baglan->clientList(array('connection_client_ip' => $_SERVER['REMOTE_ADDR']));
  31.  
  32. foreach($clientListe as $clientListeYaz)
  33. {
  34.   $clientAdYaz = $clientListeYaz['client_nickname'];
  35. }
  36.  
  37. function rastgeleSec($x) {
  38.  return $x[rand(0, sizeof($x)-1)];
  39. }
  40. function ipAdresindenSehir($ip = null){
  41.  
  42.     if($ip == null){
  43.         if(getenv('HTTP_CLIENT_IP')){
  44.             $ip = getenv('HTTP_CLIENT_IP');
  45.         }elseif(getenv('HTTP_X_FORWARDED_FOR')){
  46.             $ip = getenv('HTTP_X_FORWARDED_FOR');
  47.             if(strstr($ip, ',')){
  48.                 $gec = explode (',', $ip);
  49.                 $ip = trim($gec[0]);
  50.             }
  51.         }else{
  52.             $ip = getenv('REMOTE_ADDR');
  53.         }
  54.     }
  55.     $apiUrl = ($ayarlar['ipApi'] == 'blazinglayer') ? $apiUrl = 'http://api.blazinglayer.co.uk/ip/json/'.$ip.'/'.$ayarlar['ipApiKey'] : $apiUrl = 'http://ipinfo.io/'.$ip ;
  56.     $json = file_get_contents($apiUrl);
  57.     $detaylar = json_decode($json);
  58.     return $detaylar;
  59. }
  60.  
  61. $resim = imagecreatefrompng(rastgeleSec($resimler));
  62. $gri = imagecolorallocate($resim, 82, 82, 82);
  63. $beyaz = imagecolorallocate($resim, 255, 255, 255);
  64. $query = new ts3admin($ayarlar['host'], $ayarlar['queryPort']);
  65. $ip = ipAdresindenSehir(null);
  66.  
  67. $url = file_get_contents('http://api.apixu.com/v1/current.json?key='.$ayarlar['apiKey'].'&q='.$ip->city);
  68. $json = json_decode($url, true);
  69. date_default_timezone_set($json['location']['tz_id']);
  70.  
  71. $havaDurumuResimUrl = $json['current']['condition']['icon'];
  72. $havaDurumuResimUrl = str_replace('//', 'http://', $havaDurumuResimUrl);
  73. $fligram = imagecreatefrompng($havaDurumuResimUrl);
  74.  
  75. $konum_x = imagesx($fligram);
  76. $konum_y = imagesy($fligram);
  77.  
  78. if($query->getElement('success', $query->connect()))
  79. {
  80.     $query->login($ayarlar['queryAdi'],$ayarlar['querySifre']);
  81.     $query->selectServer($ayarlar['sunucuPort']);
  82.     $query->setName($ayarlar['botAdi']);
  83.  
  84.     $sunucuBilgi = $query->getElement('data', $query->serverInfo());
  85.     $queryClient = $sunucuBilgi['virtualserver_queryclientsonline'];
  86.     $normalClient = $sunucuBilgi['virtualserver_clientsonline'];
  87.     $sunucuKapasite = $sunucuBilgi['virtualserver_maxclients'];
  88.     $sunucuAdi = $sunucuBilgi['virtualserver_name'];
  89.     $sehirAdi = $json['location']['name'];
  90.     $sehirKacDerece = $json['current']['temp_c'];
  91.     $aktifKullanici = ($normalClient - $queryClient);
  92.    
  93.     //imagettftext($resim, 25, 0, 285, 55, $beyaz, 'CaviarDreams.ttf', $sunucuAdi);
  94.     imagettftext($resim, 17, 0, 430, 150, $beyaz, './CaviarDreams.ttf', 'Witaj, '.$clientAdYaz.'!');
  95.     imagettftext($resim, 14, 0, 23, 115, $gri, './CaviarDreams_Bold.ttf', strftime('%e %B %Y'));
  96.     imagettftext($resim, 33, 0, 25, 165, $gri, './CaviarDreams_Bold.ttf', date('H:i'));
  97.     imagettftext($resim, 29, 0, 60, 237, $gri, './CaviarDreams_Bold.ttf', ''.$aktifKullanici.'/'.$sunucuKapasite);
  98.     imagettftext($resim, 12, 0, 655, 240, $beyaz, './CaviarDreams.ttf', $sehirAdi); //miasto
  99.     imagettftext($resim, 10, 0, 750, 220, $beyaz, './CaviarDreams.ttf', $sehirKacDerece.'°');
  100.     imagecopy($resim, $fligram, imagesx($resim) - $konum_x - 55, imagesy($resim) - $konum_y - 25, 0, 0, imagesx($fligram), imagesy($fligram));
  101.    
  102. }
  103. imagepng($resim);
  104. imagedestroy($resim);
  105. ?>
Advertisement
Add Comment
Please, Sign In to add comment