* Version: 1.4.1 @ 25/06/2006 * License: GPL * * The lastest version of Clide FTP can be obtained from: * http://clide.is.free.fr/ * * You can visit the forum about Clide FTP at: * http://clide.is.free.fr/forum/ */ // Inclusion des fichiers require_once('./system/config.php'); // Fichier de configuration require_once('./system/fonctions.php'); // Fichier de fonctions // Réécriture de l'url rewritre_url(); // Protection des dossier protect(); // Vérification du dossier de stockage des sessions if (!is_dir(session_save_path())) { mkdir(session_save_path()); } // Session start session_start(); // Logout $url = $_SERVER['REQUEST_URI']; $url_path = $_SERVER['SCRIPT_NAME']; $clean_url = array($url_path => ''); $url = strtr($url, $clean_url); if ($url == '/logout/') { session_destroy(); unset($_COOKIE['PHPSESSID']); unset($_SESSION); header("Location : ../"); } if (isset($_POST['ident']) && isset($_POST['password'])) { $_SESSION['ident'] = $_POST['ident']; $_SESSION['password'] = $_POST['password']; session_regenerate_id(); setcookie("PHPSESSID", session_id(), time() + 3600); } else if (isset($_COOKIE['PHPSESSID'])) { $id = $_COOKIE['PHPSESSID']; session_id($id); setcookie("PHPSESSID", session_id(), time() + 3600); } $ident = $_SESSION['ident']; $password = $_SESSION['password']; if (isset($_SESSION['ident']) && isset($_SESSION['password']) && ($_POST['upload'] || $_POST['createdir'] || $_POST['delete'] || $_POST['dynamic']) != TRUE ) { if ( $users[$ident]['pass'] == $password && $ident != '' && $password != '') { // Génération de la liste des dossiers $arbo = arborescence(); array_multisort($arbo, SORT_ASC, SORT_STRING, $arbo); // Création de la liste des dossier sur lesquels un admin peut uploader if ( $rights[$ident] == 'all' ) { if ($root != '') { $clean_dyn = array("$root" => ''); $root_dyn = strtr($root_dyn, $clean_dyn); } $list_dir = "\n"; $list_create = "\n"; $list_delete = "\n"; $list_dynamic .= "\n"; foreach ($arbo as $dir) { $dir_light = substr($dir, 1); $dir_dyn = substr($dir, 1); if ($root != '') { $clean_dyn = array("$root" => ''); $dir_dyn = strtr($dir_dyn, $clean_dyn); } $list_dir .= "\n"; $list_create .= "\n"; $list_delete .= "\n"; $list_dynamic .= "\n"; } } // Création de la liste des dossier sur lesquels un membre à accés restreint peut uploader else { $limit = count($dir[$ident]); for ($i = 1; $i <= $limit; $i++) { $dir_light = substr($dir[$ident][$i], 1); $list_dir .= "\n"; $list_create .= "\n"; $list_delete .= "\n"; $list_dynamic .= "\n"; } } // Code de l'upload d'un fichier $html_body .= "
\n"; $html_body .= "Upload"; $html_body .= "
\n"; $html_body .= "
\n"; $html_body .= "
\n"; $html_body .= "\n"; $html_body .= "\n"; $html_body .= "\n"; $html_body .= "
\n"; $html_body .= "
\n"; $html_body .= "
\n\n"; // Code de création d'un dossier $html_body .= "
\n"; $html_body .= "Création d'un dossier"; $html_body .= "
\n"; $html_body .= "\n "; $html_body .= "\n"; $html_body .= "\n"; $html_body .= "
\n"; $html_body .= "
\n"; $html_body .= "
\n\n"; // Code de suppression d'un fichier $html_body .= "
\n"; $html_body .= "Supression d'un fichier"; $html_body .= "
\n"; $html_body .= "\n "; $html_body .= "\n"; $html_body .= "\n"; $html_body .= "
\n"; $html_body .= "
\n"; $html_body .= "
\n\n"; // Code de redirection vers l'image dynamique d'un dossier $html_body .= "
\n"; $html_body .= "URL de l'image dynamique du dossier"; $html_body .= "
\n"; $html_body .= "\n "; $html_body .= "\n"; $html_body .= "
\n"; $html_body .= "
\n"; $html_body .= "
\n\n"; // Logout $html_body .= "
\n"; $html_body .= "Déconnexion"; $html_body .= "Se déconnecter de l'administration"; $html_body .= "
\n\n"; } else { $html_body = '
Login ou Mot de passe invalide.
       
  Login :  
  Mot de Passe :  
       
'; } } else if ( ($_POST['upload']||$_POST['createdir']||$_POST['delete']||$_POST['dynamic']) && $users[$ident]['pass'] == $password && $ident != '' && $password != '') { // Upload d'un fichier if ($_POST['upload']) { $file = $_FILES['fichier']['tmp_name']; $where = $_POST['directory']."/".basename($_FILES['fichier']['name']); // Suppression du fichier s'il existe déjà if (file_exists($where)) { @unlink($where); } move_uploaded_file($file, $where); // Gestion d'erreur d'upload if ($error = $_FILES['fichier']['error']) { $html_body .= "
Il y a eu une erreur lors de l'upload du fichier : "; if ($_FILES['fichier'] == '' || $error = UPLOAD_ERR_NO_FILE) { $html_body .= "Aucun fichier n'a été téléchargé.
"; } else if ($error = UPLOAD_ERR_PARTIAL) { $html_body .= "Le fichier n'a été téléchargé que partiellement."; } else if ($error = UPLOAD_ERR_INI_SIZE) { $html_body .= "Le fichier est plus gros que la limite fixé pas le serveur."; } } // Code HTML pour les erreurs lors de l'upload else { $html_body .= "
Fichier téléchargé avec succés

"; $html_body .= '
'; $html_body .= ''; $html_body .= "
"; } } // Création d'un dossier else if ($_POST['createdir']) { if( @mkdir($_POST['root_create'].$_POST['dir']) ) { $html_body .= "
Dossier créé avec succés

"; $html_body .= '
'; $html_body .= ''; $html_body .= "
"; } else { $html_body .= "
Erreur lors de la création du dossier.

"; $html_body .= '
'; $html_body .= ''; $html_body .= "
"; } } // Suppression d'un fichier else if ($_POST['delete']) { if( @unlink($_POST['root_delete'].$_POST['file']) ) { $html_body .= "
Fichier supprimé avec succés

"; $html_body .= '
'; $html_body .= ''; $html_body .= "
"; } else { $html_body .= "
Erreur lors de la suppression du fichier.

"; $html_body .= '
'; $html_body .= ''; $html_body .= "
"; } } // Redirection vers l'image dynamique else if ($_POST['dynamic']) { $folder = $_POST['folder']; //$clean_root = array("$root" => ''); //$folder = strtr($folder, $clean_root); header("Location: ../dynamic.php"."$folder"); exit; } } else { $html_body = '
       
  Login :  
  Mot de Passe :  
       
'; } // Chargement du template template($index_template); ?>