59 lines
2.2 KiB
PHP
59 lines
2.2 KiB
PHP
<?php
|
||
/**
|
||
* Created by PhpStorm.
|
||
* User: Utilisateur
|
||
* Date: 2019-02-18
|
||
* Time: 10:11
|
||
*/
|
||
// activer les erreurs
|
||
error_reporting(E_ALL);
|
||
ini_set('display_errors', TRUE);
|
||
|
||
ini_set('display_startup_errors', TRUE);
|
||
define('EOL',(PHP_SAPI == 'cli'));
|
||
/* FTP Account (Remote Server) */
|
||
$ftp_host = 'progiweb.co'; /* host */
|
||
$ftp_user_name = 'ms1timingprod'; /* username */
|
||
$ftp_user_pass = 'Airstream2'; /* password */
|
||
|
||
/* Connect using basic FTP */
|
||
$ftpConnection = ftp_connect( $ftp_host );
|
||
ftp_pasv($ftpConnection, true);
|
||
/* Login to FTP */
|
||
$login_result = ftp_login( $ftpConnection, $ftp_user_name, $ftp_user_pass );
|
||
|
||
$arrRetour2[] = fxUploadFolder('../../css', '/home/ms1timing/domains/ms1inscriptionprod.progiweb.co/public_html/css', $ftpConnection);
|
||
$arrRetour2[] = fxUploadFolder('../../images/evenements', '/home/ms1timing/domains/ms1inscriptionprod.progiweb.co/public_html/images/evenements', $ftpConnection);
|
||
$arrRetour2[] = fxUploadFolder('../../pdf/questions', '/home/ms1timing/domains/ms1inscriptionprod.progiweb.co/public_html/pdf/questions', $ftpConnection);
|
||
$arrRetour2[] = fxUploadFolder('../../pdf/template_dons', '/home/ms1timing/domains/ms1inscriptionprod.progiweb.co/public_html/pdf/template_dons', $ftpConnection);
|
||
|
||
print_r($arrRetour2);
|
||
|
||
/* Close the connection */
|
||
ftp_close( $ftpConnection );
|
||
|
||
function fxUploadFolder($strSource, $strDestination, $ftpConnection) {
|
||
$arrRetour = array();
|
||
$directory = dir($strSource);
|
||
|
||
while($file = $directory->read()) {
|
||
if ($file != "." && $file != "..") {
|
||
if (is_dir($strSource."/".$file)) {
|
||
if (!@ftp_chdir($ftpConnection, $strDestination."/".$file)) {
|
||
ftp_mkdir($ftpConnection, $strDestination."/".$file);
|
||
}
|
||
|
||
fxUploadFolder($strSource."/".$file, $strDestination."/".$file, $ftpConnection);
|
||
} else {
|
||
ftp_chdir($ftpConnection, $strDestination);
|
||
$upload = ftp_put($ftpConnection, $file, $strSource."/".$file, FTP_BINARY);
|
||
}
|
||
}
|
||
}
|
||
|
||
$directory->close();
|
||
|
||
$arrRetour['resume'] = "R<EFBFBD>pertoire " . str_replace('../', '', $strSource) . " copi<70>\n";
|
||
|
||
return $arrRetour;
|
||
} |