• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help on server status code

rodrigor78

New Member
Joined
Aug 19, 2011
Messages
1
Reaction score
0
I need help getting my site this perfectly, plus the status appear online player, and uptime, no this is just getting offline anyone knows and can help me there's this code!
Code:
                                <?php
                                $info = chr(6).chr(0).chr(255).chr(255).'info';
                                $sock = @fsockopen($worldip , 7171, $errno, $errstr, 1);
                                if ($sock)
                                {
                                    fwrite($sock, $info);
                                    $data='';
                                    while (!feof($sock))
                                    $data .= fgets($sock, 1024);
                                    fclose($sock);
                                    // The following script shows how many players online
                                    preg_match('/players online="(\d+)" max="(\d+)"/', $data, $matches);
                                    print '&nbsp;&nbsp;.: <font color=green>ONLINE</font> :.';
                                    print '<br/><div style="color: #cec6a4">&nbsp;&nbsp;.: Players: ';
                                    print $matches[1] . '/' . $matches[2];
                                    // The following script shows uptime
                                    preg_match('/uptime="(\d+)"/', $data, $matches);
                                    $h = floor($matches[1] / 3600);
                                    $m = floor(($matches[1] - $h*3600) / 60);
                                    // And now it prints it:
                                    echo " :.<br/>&nbsp;&nbsp;.: Uptime: $h h $m m :.<br/><br/></div></div>";
                                }
                           
                                else
                                print '&nbsp;&nbsp;.: <font color=red>OFFLINE</font> :.<br/><br /></div>';
                                ?>
 

Similar threads

Back
Top