User Guide

Appendix C - PHP3 Script Examples
Axis Communications AB does not provide 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 0.9 May 2001 61
while($file_name = readdir($buffer_handle))
{
if(($file_name != ".") &&($file_name != ".."))
{ // And for each regular
//file in that directory
$file =
"/tmp/".$alarm_buffer_prefix.substr($alarm_sou
rces,$i,1)."/".$file_name;
$destination_name =
$alarm_destination.$alarm_buffer_prefix.substr
($alarm_sources,$i,1);
$destination_name .= strchr($file_name,"_");
if(!ftp_put($session, $destination_name,
$file, FTP_BINARY))
{ // Upload file
error_log("Could not upload file
".$file." as
".$destination_name."\n",0);
}
unlink($file);
}
}
closedir($buffer_handle);
}
}
else
{
error_log("Could not upload alarmbuffer. Session closed",0);
}
error_log("Restarting buffer(s)",0);
for($c=0;$c<(strlen($alarm_sources));$c++)
{ // Reset and restart
//buffers
$command="bufferd -reset -buffername
".$alarm_buffer_prefix.substr($alarm_sources,$c,1);
system($command);
$command="bufferd -start -buffername
".$alarm_buffer_prefix.substr($alarm_sources,$c,1)." -pre
".strval($pre)." -post ".strval($post)." -predelay
".strval($predelay)." -postdelay ".strval($postdelay)." -uri
ftp://jpg/".substr($alarm_sources,$c,1)."/".$alarm_image_format.
".jpg";
system($command);
}
//function handle_alarm()
}
function conv($value)
{ // A function for
//converting single digit