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 42
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 directory
if(($file_name != ".") &&($file_name != ".."))
{ // That is a regular file
$file =
"/tmp/".$buffer_prefix.substr($sources,$i,1)."/".$file_
name;
$destination_name = $destination .
$buffer_prefix.substr($sources,$i,1);
$destination_name .= strchr($file_name,"_");
// extract timestamp from src, append
//to dst
if(!ftp_put($session, $destination_name, $file,
FTP_BINARY))
{ // Upload that file to the ftp server
error_log("Could not upload file ".$file." as
".$destination_name."\n",0);
}
unlink($file);
}
}
closedir($buffer_handle);
}
}
}
else
{
error_log("Could not login as ".$user." on ".$ftp_server,0);
}
ftp_quit($session);
}
else
{
error_log("Could not connect to ".$ftp_server,0);
}
error_log("Restarting buffer(s)",0);
for($c=0;$c<(strlen($sources));$c++)
{
$command="bufferd -reset -buffername
".$buffer_prefix.substr($sources,$c,1);
s
y
stem
($
command
);










