Code: Select all
<?php
$ip = "127.0.0.1";
$port = "6667";
if (! $sock = @fsockopen($ip, $port, $num, $error, 5))
echo '<strong><font color="#FF0000">Offline</font></strong>';
else{
echo '<strong><font color="#00CC00">Online</font></strong>';
fclose($sock);
}
?>
Dann wird die Tabelle zwar noch angezeigt aber, nur wird eine einzige Zeile angezeigt und der "offline" und "online" Status nicht mehr.
Und dieses Problem hatte ich sonst nie und ist auch mit der PHP 7.3 und gerade da hat es "immer" ohne Probleme funktioniert.
Spricht: An der PHP 7.4.25 kann es nicht liegen, ich habe das jetzt maximal nur 2x und dann:
Code: Select all
<?php
//Basic configuration
$sip = "127.0.0.1"; //server IP
$sport = "6667"; //server PORT
if(realm_status($sip, $sport) === false)
{
//echo '<img title="OFFLINE" alt="OFFLINE" src="offline.gif">';
echo '<strong><font color="#FF0000">Offline</font></strong>';
}
else if(realm_status($sip, $sport) === true)
{
//echo '<img title="ONLINE" alt="ONLINE" src="online.gif">';
echo '<strong><font color="#00CC00">Online</font></strong>';
}
//Function to check if the provided IP and PORT is reachable
function realm_status($host, $port)
{
error_reporting(0);
$etat = fsockopen($host,$port,$errno,$errstr,3);
if(!$etat)
{
return false;
}
else
{
return true;
}
}
?>
Code: Select all
<?php
$ip = "127.0.0.1";
$port = "6667";
$timeout = "10";
if ($ip and $port and $timeout)
{
$rootserver = @fsockopen("$ip", $port, $timeout);
}
if($rootserver)
{
echo '<strong><font color="#00CC00">Online</font></strong>';
}
else
{
echo '<strong><font color="#FF0000">Offline</font></strong>';
}
?>