System information
An Introduction to PHP3
Axis Communications AB provides NO support for application development of any kind. The information
here is provided "as is", and there is no guarantee that any of the examples shown will work in your
particular application.
Revision 1.02 October 2002 37
error_log("No such file: ".$source_file,0);
}
$current_time = gettimeofday();
$ellapsed = ($current_time["sec"] -
$loop_start["sec"]) * 1000000;
if($current_time["usec"] > $loop_start["usec"])
$ellapsed += $current_time["usec"] -
$loop_start["usec"];
else
$ellapsed -= $current_time["usec"] -
$loop_start["usec"];
$wait = ($delay * 1000) / strlen($sources);
if($ellapsed < $wait)
{ // Wait if needed (in order to
//follow the delay specified
//and spread the traffic)
usleep($wait - $ellapsed);
}
//Calculate session time
$session_time = ($current_time["sec"] -
$start_time["sec"]);
if($current_time["usec"] > $start_time["usec"])
$session_time += ($current_time["usec"] -
$start_time["usec"])/1000000;
else
$session_time -= ($current_time["usec"] -
$start_time["usec"])/1000000;
}
if($session_time>=$time) error_log("Timed upload
complete",0);
if($failures>=(strlen($sources)*2)) error_log("Too many
consecutive failures",0);
}
}
else
{
ftp_quit($session);
error_log("Could not log in as ".$user." on ".$ftp_server,0);
}
ftp_quit($session);
}
else
{
error_log("Could not connect to ".$ftp_server.":".$port,0);
}
for($c=0;$c<(strlen($sources));$c++)
{ //Reset buffers
//$command="bufferd -stop -buffername
//".$buffer_prefix.substr($sources,$c,1);
//system($command);
$command="bufferd -reset -buffername
".$buffer_prefix.substr($sources,$c,1);