[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/include/db_backup/ -> ftp.php (source)

   1  <?php
   2  /*********************************************************************************
   3  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9  *
  10   ********************************************************************************/
  11  
  12  function ftpBackupFile($source_file, $ftpserver, $ftpuser, $ftppassword)
  13  {
  14      global $log;
  15          $log->debug("Entering ftpBackupFile(".$source_file.", ".$ftpserver.", ".$ftpuser.", ".$ftppassword.") method ...");    
  16      // set up basic connection
  17      $conn_id = @ftp_connect($ftpserver);
  18      if(!$conn_id)
  19      {
  20          $log->debug("Exiting ftpBackupFile method ...");
  21          return;
  22      }
  23      
  24  
  25      // login with username and password
  26  
  27      $login_result = @ftp_login($conn_id, $ftpuser, $ftppassword);    
  28  
  29      if(!$login_result)
  30      {
  31          ftp_close($conn_id);
  32           $log->debug("Exiting ftpBackupFile method ...");
  33          return;
  34      }
  35  
  36      // check connection
  37      /*if ((!$conn_id) || (!$login_result)) {
  38          echo "FTP connection has failed!";
  39          echo "Attempted to connect to $ftp_server for user $ftp_user_name";
  40          exit;
  41      } else {
  42          echo "Connected to $ftp_server, for user $ftp_user_name";
  43      }
  44      */
  45  
  46      // upload the file
  47      $destination_file=$source_file;
  48      $upload = @ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
  49  
  50      // check upload status
  51      if (!$upload) {
  52          ftp_close($conn_id);
  53           $log->debug("Exiting ftpBackupFile method ...");
  54          return;
  55      }
  56      /*
  57       else {
  58          echo "Uploaded $source_file to $ftp_server as $destination_file";
  59      }*/
  60  
  61      // close the FTP stream
  62      ftp_close($conn_id);
  63       $log->debug("Exiting ftpBackupFile method ...");
  64  }
  65  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7