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
https://forums.phpfreaks.com/topic/110151-timing-out/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.