Jump to content

Timing out...


Im Jake

Recommended Posts

thats my php script, it takes 1 second to ping each server, well my webhost times out after 30-45 seconds, so after that long it times out after i get 30-45 servers on the status page, how can i make it so that it will do it quicker or ping more servers every second?

 

<?php
include("includes/connection.inc.php");
$results = @mysql_query("SELECT id, name, ip, port, uptime, status FROM servers") or die();
while($values = mysql_fetch_array($results)){
list($online, $offline) = explode(',', $values['uptime']);
$socket = @fsockopen(stripslashes($values['ip']), stripslashes($values['port']), $errno, $errstr, 1);
if($socket){
	$status = 'online';
	$online = intval($online) + 1;
} else{
	$status = 'offline';
	$offline = intval($offline) + 1;
}
$uptime = $online . ',' . $offline;
echo 'Server: ' . $values['name'] . ' is ' . $status . '<br />';
$resultsUpdate = @mysql_query("UPDATE servers SET uptime='$uptime', status='$status' WHERE id=" . $values['id']) or die();
}
$time = time();
$resultsTime = @mysql_query("UPDATE config SET lastupdate='$time'") or die();
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.