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 30
The second part of the script is where it all happens:
1 All pre/post alarm buffers previously started by utask are stopped.
2 Waits until all post-alarm images are stored.
3 FTP transfer of all images.
4 Restart of pre/post alarm buffers.
5 Exit.
for($c=0;$c<(strlen($sources));$c++)
{ // Stop the, by utask,
//started buffers
$command="bufferd -stop -buffername
".$buffer_prefix.substr($sources,$c,1);
system($command);
}
error_reporting(0);
for($c=0;$c<(strlen($sources));$c++)
{ // For each buffer specified
$status_file =
"/tmp/".$buffer_prefix.substr($sources,$c,1)."/status";
while(!is_file($status_file))
{ // Wait until bufferd is
//ready with the images, i.e.
//the status file is present
sleep(($predelay+$postdelay)/1000);
}
unlink($status_file);
}
error_reporting(E_ALL);
$session = ftp_connect($ftp_server, $port);
if($session)
{ // Connection successfully
//established
if(ftp_login($session, $user, $pass))
{ // Successful login attempt
if (!ftp_pasv($session, $passive_mode == "yes"))
{
error_log("Could not set passive mode",0);
}
else
{ // Passive mode successfully
//set
for($i=0;$i < (strlen($sources));$i++)
{ // For each buffer specified
$directory="/tmp/".$buffer_prefix.substr($sources
,$i,1);
$buffer_handle = opendir($directory);
While($file_name = readdir($buffer_handle))
{ // And for each file in the
//corresponding buffer