Guest User

Untitled

a guest
Jul 21st, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. $dbhost = 'localhost';
  10.  
  11. $dbuser = 'we';
  12.  
  13. $dbpass = 'pass';
  14.  
  15. $dbname = 'wecraftrp';
  16.  
  17. $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('blad laczenia z baza danych');
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. mysql_select_db($dbname);
  32.  
  33.  
  34.  
  35. $q = mysql_query("select count(name) as count from users_online where online='1'") or die(mysql_error());
  36.  
  37. $row = mysql_fetch_array($q);
  38.  
  39. $ucount = $row['count'];
  40.  
  41. unset($q);
  42.  
  43. $q = mysql_query("select name from users_online where online='1'") or die(mysql_error());
  44.  
  45. while($row = mysql_fetch_array($q)) {
  46.  
  47. $olist .= "";
  48.  
  49. }
  50.  
  51.  
  52.  
  53. // sciezka do pliku z klasa
  54.  
  55. require_once('status/class.hlsocket.php');
  56.  
  57.  
  58.  
  59. // przykladowe czcionki
  60.  
  61. define('TEMPESTA', 'status/fonts/tempesta.ttf');
  62.  
  63. define('MINE', 'status/fonts/mine.ttf');
  64.  
  65. define('TAHOMA', 'status/fonts/tahoma.ttf');
  66.  
  67. define('VERDANA', 'status/fonts/verdana.ttf');
  68.  
  69. define('TAHOMA_BOLD', 'status/fonts/tahoma_bold.ttf');
  70.  
  71.  
  72.  
  73. $serwer="37.59.1.44";
  74.  
  75. $port="25565";
  76.  
  77. $socket=@fsockopen($serwer,$port,$errno,$errstr,2);
  78.  
  79.  
  80.  
  81. if($socket==true)
  82.  
  83. {
  84.  
  85. $im = imagecreatefrompng("status/background.png");
  86.  
  87. $white = imagecolorallocate($im, 255, 255, 255);
  88.  
  89. $red = imagecolorallocate($im, 233, 18, 29);
  90.  
  91. $info = " ";
  92.  
  93. imagettftext($im, 12, 0, 37, 24, $white, MINE, "RP.WEMC.PL");
  94.  
  95. imagettftext($im, 12, 0, 41, 24, $white, MINE, " $ucount/100"); //
  96.  
  97.  
  98.  
  99.  
  100.  
  101. }else{
  102.  
  103.  
  104.  
  105.  
  106.  
  107. $im = imagecreatefrompng("status/backgroundoff.png");
  108.  
  109. $white = imagecolorallocate($im, 255, 255, 255);
  110.  
  111. $red = imagecolorallocate($im, 233, 18, 29);
  112.  
  113. $info = " ";
  114.  
  115. imagettftext($im, 12, 0, 41, 24, $white, MINE, "RP.WEMC.PL");
  116.  
  117. imagettftext($im, 12, 0, 41, 24, $red, MINE, " OFF");
  118.  
  119.  
  120.  
  121.  
  122.  
  123. }
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. // okreslenie typu zawartosci
  132.  
  133. header('Content-type: image/png');
  134.  
  135. imagepng($im);
  136.  
  137. imagedestroy($im);
  138.  
  139. ?>
Add Comment
Please, Sign In to add comment