Nieoficjalna polska strona Lineage 2

Lineage 2 => Prowadzenie własnego serwera => Serwery prywatne => Praca z serwerem => Wątek zaczęty przez: l2shock w Czerwiec 21, 2011, 12:59:00 AM

Tytuł: Skrypt PHP Status Servera
Wiadomość wysłana przez: l2shock w Czerwiec 21, 2011, 12:59:00 AM
Witam potrzebje najlatwiejszy skrypt na status serwera jaki jest tylko możliwy pod php najlepiej. Chodzi tylko o Login i Game Server fajnie by bylo jakby wyświetlaly sie kulki zielone ( kiedy serwer bedzie on) i czerwony (kiedy off). Z góry dziekuje.
Tytuł: Odp: Skrypt PHP Status Servera
Wiadomość wysłana przez: Shyque w Czerwiec 21, 2011, 10:25:32 AM
Proszę bardzo :) bardzo prosty skrypt pokazujący status servera.
Skrypt wygląda tak:
(https://forum.lineage2.com.pl/proxy.php?request=http%3A%2F%2Fi51.tinypic.com%2Fsp7uz8.png&hash=6f3f6a1383101fe770dfb1a3ed91d522234466f8)
<?php

$server
= "localhost";
$port = "2106";

function
pingDomain($server){
   
$starttime = microtime(true);//Server 1 Port
   
$file      = @fsockopen ($domain, 2106, $errno, $errstr, 10);
   
$stoptime  = microtime(true);
   
$status    = 0;

   if (!
$file) $status = -1;
   else {
       
fclose($file);
       
$status = ($stoptime - $starttime) * 1000;
       
$status = floor($status);
   }
   return
$status;
}      

       
$status = pingDomain($serverbase);
       if (
$status <= 50) $MessageStatus = "Great";
       elseif (
$status <= 80) $MessageStatus = "Good";
       elseif (
$status <= 100) $MessageStatus = "Ok";
       elseif (
$status <= 150) $MessageStatus = "Bad";
       elseif (
$status <= 999) $MessageStatus = "Poor";
       else
$MessageStatus = "Disconnected";


$upmessage = "<font size='1' color='white'><br>Stability: </font><font color='gray'

size='1'>
$MessageStatus</font><br>";
$downmessage = "<font size='1' color='white'><br>Stability: </font><font color='gray'

size='1'>Disconnected</font><br>"
;
$tout = "5";
$server1 = @fsockopen ($server, $port, $errno, $errstr, $tout);
if(!
$server1){ echo"<br><font color='C8B560' size='2' style='Arial'><strong>Login</strong></font><br><font

size='1' color='white'>Status:</font><font color='red' size='1' style='Arial'> Off</font>
$downmessage"; }
else { echo
"<br><font color='C8B560' size='2' style='Arial'><strong>Login</strong></font><br><font size='1'

color='white'>Status:</font><font color='green' size='1' style='Arial'> On</font>
$upmessage"; }

$server2 = "localhost";
$port2 = "7777";

function
pingDomain2($server2){
   
$starttime2 = microtime(true);//Server 2 Port
   
$file2      = @fsockopen ($domain2, 7777, $errno, $errstr, 10);
   
$stoptime2  = microtime(true);
   
$status2    = 0;

   if (!
$file2) $status2 = -1;
   else {
       
fclose($file2);
       
$status2 = ($stoptime2 - $starttime2) * 1000;
       
$status2 = floor($status2);
   }
}      

       
$status2 = pingDomain2($serverbase2);
       if (
$status2 <= 50) $MessageStatus2 = "Great";
       elseif (
$status2 <= 80) $MessageStatus2 = "Good";
       elseif (
$status2 <= 100) $MessageStatus2 = "Ok";
       elseif (
$status2 <= 150) $MessageStatus2 = "Bad";
       elseif (
$status2 <= 999) $MessageStatus2 = "Poor";
       else
$MessageStatus2 = "Disconnected";


$upmessage2 = "<font size='1' color='white'><br>Stability: </font><font color='gray'

size='1'>
$MessageStatus2</font><br>";
$downmessage2 = "<font size='1' color='white'><br>Stability: </font><font color='gray'

size='1'>Disconnected</font><br>"
;
$tout = "5";
$server2 = @fsockopen ($server2, $port2, $errno, $errstr, $tout);
if(!
$server2){ echo"<br><font color='C8B560' size='2'

style='Arial'><strong>Gameserver</strong></font><br><font size='1' color='white'>Status:</font><font

color='red' size='1' style='Arial'> Off</font>
$downmessage2"; }
else { echo
"<br><font color='C8B560' size='2' style='Arial'><strong>Gameserver</strong></font><br><font

size='1' color='white'>Status:</font><font color='green' size='1' style='Arial'> On</font>
$upmessage2"; }
?>


Ale jeżeli chcesz tak bardzo kulki tutaj masz prosty generator statusu :)
http://maxvotes.com/index.php?p=status (http://maxvotes.com/index.php?p=status)
Tytuł: Odp: Skrypt PHP Status Servera
Wiadomość wysłana przez: Vearth w Czerwiec 21, 2011, 11:46:20 AM
[quote author=l2shock link=topic=43674.msg529324#msg529324 date=1308610740]
Witam potrzebje najlatwiejszy skrypt na status serwera jaki jest tylko możliwy pod php najlepiej. Chodzi tylko o Login i Game Server fajnie by bylo jakby wyświetlaly sie kulki zielone ( kiedy serwer bedzie on) i czerwony (kiedy off). Z góry dziekuje.
[/quote]
lol  :shock:  :o