Axis 2401 - PHP3 GUIDE Informacje Techniczne Strona 35

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
Przeglądanie stron 34
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 35
$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;
while( ($failures<(strlen($sources)*2)) && (
($session_time<$time)||($time==-1) ))
{ //Upload images as long as
//not too many errors have
//occurred and session time
//has not been exceeded
$loop_start = gettimeofday();
$active_buffer++;
if($active_buffer==strlen($sources))
{ // Loop through the indexes
//specified as sources
$active_buffer=0;
}
$source_file="/tmp/".$buffer_prefix.substr
($sources,$active_buffer,1)."/".$file_format.".jpg";
//Build the destination name
//according to the suffix
//specified
$dest=$destination.$buffer_prefix.substr
($sources,$active_buffer,1);
if($suffix == "date")
{
$tinfo = getdate(time());
$dest .= "_" . conv($tinfo["year"]);
$dest .= "-" . conv($tinfo["mon"]);
$dest .= "-" . conv($tinfo["mday"]);
$dest .= "_";
$dest .= conv($tinfo["hours"]);
$dest .= conv($tinfo["minutes"]);
$dest .= conv($tinfo["seconds"]);
}
else if($suffix == "sequence_max")
{
$dest .= "_" . strval($current_counter);
$inc++;
if($inc >= strlen($sources))
{
$current_counter++;
Przeglądanie stron 34
1 2 ... 30 31 32 33 34 35 36 37 38 39 40 ... 84 85

Komentarze do niniejszej Instrukcji

Brak uwag