Jelajahi Sumber

Suppression du fichier de test

stany.ferer 1 tahun lalu
induk
melakukan
591dd3192b
1 mengubah file dengan 0 tambahan dan 89 penghapusan
  1. 0 89
      public-cms/test.php

+ 0 - 89
public-cms/test.php

@@ -1,89 +0,0 @@
-<?php
-session_start();
-
-error_reporting(E_ALL);
-ini_set('display_errors', 1);
-
-$test = 2;
-
-if($test == 1) {
-    define("SFTP_HOST", "home595637013.1and1-data.host");
-    define("SFTP_USER", "u543064336");
-    define("SFTP_PASS", "1wx3c4cdfv6sz");
-    define("SFTP_REMOTE", "/");
-} else {
-    define("SFTP_HOST", "46.105.33.123");
-    define("SFTP_USER", "sftp_35034");
-    define("SFTP_PASS", "4ALSyzu43tDh5hVQ82kL29");
-    define("SFTP_REMOTE", "/import/");
-}
-
-define("DOCUMENT_ROOT", "/var/www/dev.cms.cse-invent.com/");
-define("SFTP_LOCAL", DOCUMENT_ROOT . "datas/sftp/");
-
-$authent = "";
-
-echo SFTP_LOCAL;
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-function testSFTP(){
-    $originalConnectionTimeout = ini_get('default_socket_timeout');
-    ini_set('default_socket_timeout', 2);
-    if ($authent = @ssh2_connect(SFTP_HOST, 22)) {
-        ini_set('default_socket_timeout', $originalConnectionTimeout);
-        echo "<div>Accès serveur OK</div>";
-    } else {
-        echo "<div>Accès serveur en erreur</div>";
-    }
-
-    if (@ssh2_auth_password($authent, SFTP_USER, SFTP_PASS)) {
-        echo "<div>Authentification OK</div>";
-    } else {
-        echo "<div>Authentification En erreur</div>";
-    }
-
-    if ($connexion = @ssh2_sftp($authent)) {
-        echo "<div>Connexion OK</div>";
-    } else {
-        echo "<div>Connexion En erreur</div>";
-    }
-
-    $stream = @fopen("ssh2.sftp://" . $connexion . SFTP_REMOTE . "test.txt", "w");
-    if ($stream == FALSE){
-        echo "<div>Impossible d'écrire sur le serveur distant</div>";
-    } else {
-        echo "<div>Succès d'écriture sur le serveur distant</div>";
-    }
-
-    $realpath = @ssh2_sftp_realpath($connexion, SFTP_REMOTE);
-    $dir = "ssh2.sftp://" . $connexion . $realpath;
-    $tempArray = array();
-
-    if (is_dir($dir)) {
-        if ($dh = opendir($dir)) {
-            while (($file = readdir($dh)) !== false) {
-                echo $file;
-                $tempFile = NULL;
-                $realpath = @ssh2_sftp_realpath($connexion, $file);
-                $filetype = filetype($dir . $realpath);
-                $size = sprintf("%.2f", filesize($dir . $realpath));
-
-                if ($filetype != "dir") {
-                    $infos = @ssh2_sftp_stat($connexion, SFTP_REMOTE.$file);
-                    $tempFile["file"] = $file;
-                    print_r($infos);
-                    //$tempFile["size"] = $infos["size"];
-                   // $tempFile["date"] = $infos["atime"];
-                    $tempArray[] = $tempFile;
-                }
-            }
-            closedir($dh);
-        }
-    }
-    print_r($tempArray);
-}
-
-testSFTP();
-
-