server status php?

04/21/2012 03:00 .x3Bit#1
Hay ich ne kleine frage...
PHP Code:
<?PHP
include "./inc/dbsettings.php";
$ip gethostbyname($serverip1);
$portlist=array(13001);
$onliner=array("Channel 1");
$server=array("Channel 1");
$i=0;
foreach  (
$portlist as $port){
    
$online = @fsockopen($ip$port$errno$errstr1);
    if (!
$online)
    {
        echo 
"<span class='offline tooltip' title='$onliner[$i] ist offline.'>&bull; $onliner[$i]</span><br />";
        $
$onliner[$i] = "0";
    }
    else
    {
        echo 
"<span class='online tooltip' title='$onliner[$i] ist online.'>&bull; $onliner[$i]</span><br />";
        $
$onliner[$i] = "1";
    }
    @
fclose($online);
$i++;
}
?>
wie kriege ich es hin das wen der server on is das, dass Online in grün angezeigt wird? wen ich
PHP Code:
<font color="green"> </font
dahin packe gehts net >_>
04/21/2012 03:20 Anonyme™#2
Ich finde deine Status.php ein Bisschen Komisch(Fail^^)

Deshalb probier mal diese Hier.

PHP Code:
        <?php
        $ip 
gethostbyname(SQL_HOST);
        
$portlist=array(3306,1100213000, ); // Den port den ihr sehen wollt
        
$status=array("LOGIN:""CHAR:""WORLD:");  // Bezeichnung
        
$i=0;
        
mysql_select_db("player");
        
$output mysql_query("SELECT COUNT(*) as count FROM player WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) < last_play;");
        
$online_count mysql_fetch_object($output)->count+1;
        echo 
"<p>Es sind  <font color=#6c9ffd> $online_count</font> Spieler Online </p>";

    foreach  (
$portlist as $port){
    echo 
"<p><font>".$status[$i]."</font>";
        
$online = @fsockopen($ip$port$errno$errstr1);
    if (!
$online)
    {
        echo 
"<font color=#008000> ONLINE </font></p>"
        
;

    }
    else
    {
        echo 
"<font color=#8b0000> OFFLINE </font></p> ";
    }
        @
fclose($online);
        
$i++;
    }  
    
?>
Hoffe konnte dir damit Helfen ;)

MFG
Flingernboy
04/21/2012 04:16 .x3Bit#3
Ne das is mega hässlich xD
04/21/2012 04:23 Anonyme™#4
Nee Meine Status.php is Viel besser ;) !

Habe dich Skype Hinzugefügt. Würde mich freuen, Wen du Annehmen würdest ;)

MFG
Flingernboy
04/21/2012 04:29 Hyukisawa#5
PHP Code:
<?PHP 
include "./inc/dbsettings.php"
$ip gethostbyname($serverip1);
$portlist=array(13001); 
$onliner=array("Channel 1"); 
$server=array("Channel 1"); 
$i=0
foreach  (
$portlist as $port){ 
    
$online = @fsockopen($ip$port$errno$errstr1); 
    if (!
$online
    { 
        echo 
"<span class='offline tooltip' title='$onliner[$i] ist offline.'>&bull; <font color='red'>$onliner[$i]</font></span><br />"
        $
$onliner[$i] = "0"
    } 
    else 
    { 
        echo 
"<span class='online tooltip' title='$onliner[$i] ist online.'>&bull; <font color='green'>$onliner[$i]</font></span><br />"
        $
$onliner[$i] = "1"
    } 
    @
fclose($online); 
$i++; 

?>
so sollte es gehen :)
04/21/2012 08:56 .BonG™#6
Es geht eigendlich viel leichter und kleiner, aber ich poste es einfach mal:


Lg
02/13/2014 15:15 rudik1234#7
Bitte um Hilfe weiß nicht was da falsch ist :/

PHP Code:
<img style="margin-top:15px;" id="loading" src="./img/loading.gif"/>
<div class="online-status" style="font-size:12px;">
<div id="status_pos">
<?php

        $ip 
gethostbyname($serverSettings['25.136.93.190']);
        
$portlist=array(3306,11002,13001,13002); // Ports
        
$status=array("Mysql Server:""Login Server:""Channel1:""Channel2:");  // Bezeichnung
        
$i=0;


    foreach  (
$portlist as $port){

        
$online = @fsockopen($ip$port$errno$errstr1);
    if (
$online)
    {
    echo 
'<div id="status_bar">';
        echo 
'<tr>'.$status[$i].
        <font color="#04bc00">Online</font>
        '
;
    echo 
'</div>';
    }
    else
    {
    echo 
'<div id="status_bar">';
        echo 
'<tr>'.$status[$i].'  
        <font color="#cf0000">Offline</font>
        '
;
    echo 
'</div>';
    }
        @
fclose($online);
        
$i++;
    }

    
?>
<div id="status_bar">
<?php
    $result1 
mysql_fetch_assoc(mysql_query("SELECT COUNT(id) AS count FROM player.player WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) < last_play"));
        echo 
'Spieler Online: <font color="#749db7">'.$result1['count'].' </font>';

?>
</div>
</div>
</div>