Jump to content


Photo

Show latency...


  • Please log in to reply
1 reply to this topic

#1 ShibSta

ShibSta
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 01 May 2006 - 05:08 PM

I have a script that tells if a server is online or not however I know a few people who think I update it manually.
I'd like to have the site ping the server and display the ping.
Currently I am using this: [a href=\"http://pastebin.com/692046\" target=\"_blank\"]http://pastebin.com/692046[/a]
To add servers I simply have:
<?php
include 'serverstatus.php';
$test = new status;
$test->AddService('000.000.000.000', 1111, 'name', 'tcp');
$data = $test->GetStatus();
?>
</span>
<table border="0" cellpadding="0" cellspacing="0" class="status">
<tr><td colspan="2" class="top">&nbsp;
</td>
</tr>
<?php
for ($i = 0; $i <= count($data) - 1; $i++) {
    if ($data[$i]['status']) {
        //$img = '<img src="on.gif" width=12 height=12>';
        $img = $on = 'online';
    } else {
        $img = $off ='down';
        // $img = '<img src="off.gif" width=12 height=12>';
    }
    ?>
    <tr>
    <td nowrap class="left">- <strong class="yellow"><?php echo $data[$i]['service'];
    ?></strong></td>
    <td nowrap class="right"><span class="up"><?php echo $img;
    ?></span></td>
    </tr>
    <?php
}
?>

Now I want to combine it with the latency feature of this page.
[a href=\"http://pastebin.com/692050\" target=\"_blank\"]http://pastebin.com/692050[/a]
I am fairly new to this so if someone could practically give me the code I'd appriciate it. I am more of a visual learner by seeing before/after...

I need to get the ping into a varible such as $lat or $ping so I can display it on my content page, also if the server is online it will display the ping and if not it will say "down".

#2 ShibSta

ShibSta
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 02 May 2006 - 09:53 AM

Bump^^




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users