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 51
There is no need to edit anything below this line.
error_reporting(0);
function conv($value)
{ // A function for converting
//single digit integers into
//two digit integers
if($value < 10) {
$value = "0$value";
}
return strval($value);
}
for($c=0;$c<(strlen($sources));$c++)
{ // Start the buffers as
//specified by the parameters
//above
$command="bufferd -start -buffername ";
$command.=$buffer_prefix.substr($sources,$c,1);
$command.=" -snapshot -pre 1 -predelay ";
$command.=strval($delay);
$command.=" -uri ftp://jpg/";
$command.=substr($sources,$c,1);
$command.="/";
$command.=$image_format;
$command.=".jpg -format ";
$command.=$file_format;
system($command);
}
$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"))
{
ftp_quit($session);
error_log("Could not set passive mode",0);
}
else
// Passive mode successfully
//set
$start_time = gettimeofday();
$current_time = $start_time;
$session_time = 0;
$inc = 0;
$active_buffer = -1;
$failures=0;