Advertisement
nullzwo

Untitled

Feb 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. <?php
  2. header('Content-type: image/png');
  3.  
  4. require_once('libraries/TeamSpeak3/TeamSpeak3.php');
  5. require_once('config.php');
  6.  
  7. $failure = false;
  8.  
  9.  
  10.  
  11. if($_SERVER['REMOTE_ADDR'] == "31.19.106.65" && date("G",time()) >= 11 && date("G",time()) < 18){
  12. array_push($config['gruss'],"Guten Morgen");
  13. }
  14.  
  15. $grussformel = utf8_encode($config['gruss'][mt_rand(0,count($config['gruss'])-1)]);
  16.  
  17. $file = "user.txt";
  18.  
  19. $userlist = file($file);
  20. for($i=0;$i < count($userlist); $i++){
  21. if(!empty($userlist[$i])){
  22. $userparts = explode("=43a242skds4ad0lf23ad3g0rg02853sd#fdr0bert0bl4nc0si74uaf65ds>",$userlist[$i]);
  23.  
  24. if(!(empty($userparts[0]) || empty($userparts[1]))){
  25. $user[$userparts[0]] = $userparts[1];
  26. }
  27. }
  28. }
  29.  
  30. if (array_key_exists($_SERVER['REMOTE_ADDR'],$user)){
  31. $grussformel = $grussformel." ".$user[$_SERVER['REMOTE_ADDR']];
  32. } else {
  33. $client = [];
  34. $clients = [];
  35. try {
  36. $ts3 = TeamSpeak3::factory(
  37. "serverquery://". $config['loginname'] .":". $config['loginpass']
  38. ."@". $config['ip'] .":". $config['queryport']
  39. ."/?server_port=". $config['serverport'];)
  40.  
  41. $client = $ts3->clientList();
  42. } catch (Exception $e) {
  43. $failure = true;
  44. }
  45. foreach($client as $x){
  46. $clients[htmlentities($x->connection_client_ip)] = htmlentities($x->client_nickname);
  47. }
  48.  
  49. foreach($clients as $x => $y){
  50. $user[$x] = $y;
  51. }
  52.  
  53. if (array_key_exists($_SERVER['REMOTE_ADDR'],$clients) && !$failure){
  54. $grussformel = $grussformel." ".$clients[$_SERVER['REMOTE_ADDR']];
  55. } else {
  56. $grussformel = "";
  57. }
  58.  
  59. $textfilestr = "";
  60. foreach($user as $x => $y){
  61. if(!(empty($x) || empty($y))){
  62. $textfilestr .= $x."=43a242skds4ad0lf23ad3g0rg02853sd#fdr0bert0bl4nc0si74uaf65ds>".$y."\n";
  63. }
  64. }
  65. file_put_contents($file, $textfilestr);
  66. }
  67.  
  68. $grussformel = mb_convert_encoding($grussformel, 'HTML-ENTITIES',"UTF-8");
  69. $grussformel = html_entity_decode($grussformel, ENT_NOQUOTES, "ISO-8859-1");
  70.  
  71. $total = (intval(date("G",time())) * 3600) + (intval(date("i",time())) * 60) + intval(date("s",time()));
  72.  
  73. $hour = floor($total / 10000);
  74. $min = floor($total % 10000 / 100);
  75.  
  76. $text = "WELTENTE";
  77. $datum = date("d.m.Y",time());
  78. $uhr = date("H:i",time()+60)." MEZ | ".sprintf("%02d", $hour).":".sprintf ("%02d", $min)." ENT";
  79.  
  80. $bild = imagecreatefrompng('images/weltente_banner_background_white.png');
  81.  
  82. $text_color = ImageColorAllocate ($bild, 197, 32, 51);
  83. $font = 'fonts/open-sans.ttf';
  84.  
  85. imagettftext($bild, 25, 0, 1100, 55, $text_color, $font, $datum);
  86.  
  87. imagettftext($bild, 100, 0, 435, 190, $text_color, $font, $text);
  88.  
  89. $bbox = imagettfbbox(25, 0, $font, $uhr);
  90. $center = (imagesx($bild) / 2) - (($bbox[2] + 75 - $bbox[0]) / 2) ;
  91.  
  92. imagettftext($bild, 50, 0, $center, 280, $text_color, $font, $uhr);
  93.  
  94.  
  95. $bbox = imagettfbbox(25, 0, $font, $grussformel);
  96. $center = (imagesx($bild) / 2) - (($bbox[2] - 250 - $bbox[0]) / 2) ;
  97.  
  98. imagettftext($bild, 25, 0, $center, 350, $text_color, $font, $grussformel);
  99.  
  100. imagepng ($bild);
  101.  
  102. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement