Stránka 1 z 1

PHP Status

Napsal: 02 lis 2014, 21:24
od Thewest123
Server: nemám

Zdravím všechny. Nejsem si úplně tak jistej, jestli tohle téma patří sem, ale něco jako PHP atd tu není :D

Dělálm status na server podle tohoto návodu: https://forums.bukkit.org/threads/web-p ... ry.144329/
Mám index.php
Spoiler: zobrazit

Kód: Vybrat vše

<?php
$server = '91.93.250.203'; // IP nebo adresa
$port = 25565; // port serveru
$verze = '1.7.*';
 
// Vytvori obrazek o rozmerech
$image_width = 739; // px
$image_height = 485; // px
$im = imagecreatefrompng("signa.png");
 
// Nastavi barvy
$black = imagecolorallocate($im, 0, 0, 0);
$red = imagecolorallocate($im, 204,0,0);     
$blue = imagecolorallocate($im, 0,0,255);
$green = imagecolorallocate($im, 0,255,51);
$green2 = imagecolorallocate($im, 0,153,0);
$font_file = 'arial.ttf'; // umístění
$font = 'Minecraft.ttf';
 
// Nacti classu a vykresli obrazek



   include_once 'MinecraftServerStatus/status.class.php';
   $status = new MinecraftServerStatus();
    $response = $status->getStatus($server, $verze, $port);
   if(!$response) {
      echo"Server je Offline!!";
   } else {
   header('Content-Type: image/png');
    imagefttext($im, 25, 0, 370, 40, $green, $font, 'Online');
    imagefttext($im, 15, 0, 50, 70, $blue, $font_file, $response['motd']);
    imagefttext($im, 15, 0, 50, 90, $blue, $font_file, 'IP: '.$response['hostname'].":".$response['port']);
    imagefttext($im, 15, 0, 50, 110, $blue, $font_file, 'Hraci: '.$response['players'].'/'.$response['maxplayers']);
    imagefttext($im, 15, 0, 50, 130, $blue, $font_file, 'Verze: '.$response['version']);
   imagepng($im);
   }



// vycisti cache
imagedestroy($im);
?>


Co jsem zjistil, (zkoušel jsem servery od Fakahedy, ale i další), funguje to jen na portu 25565. Na ostatních portech mi to nefunguje.
Tady to je: http://test.vycraftito.eu/status/ (s portem 25565 - funkční obrázek, když jiný port - Píše mi to Server je offline!)
S designem jsem si zatim nehrál.

Má tady s tím někdo zkušenosti?
Předem díky za odpovědi :)

Re: PHP Status

Napsal: 02 lis 2014, 22:06
od Smexhy
Nesúvisí s technickou podporou MC servera, takže topic presúvam.

Re: PHP Status

Napsal: 15 lis 2014, 18:29
od Thewest123
Ok, už mi to funguje.
Ani nevím, jak jsem to udělal :D

Prosím o smazání tohoto tématu. Když nepůjde smazat, prosím alespoň lock :)

Díky

Re: PHP Status

Napsal: 16 lis 2014, 16:42
od Smexhy
Nemažeme ani neolockujeme zbytočne, len keď je to nevyhnutné ;)