// // ------------------------------------------------------------------------- // // http://phpuptomyftp.sourceforge.net // // ------------------------------------------------------------------------- // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------- // /** * Fonction inscrivant les visiteurs dans un fichier log (logs/visitors) */ function logVisiteur() { global $HTTP_REFERER; global $REMOTE_ADDR; $time = date("j/m/y - H:i", time()); $fp = @fopen("logs/visitors.log", "a+"); if($fp){ if(empty($HTTP_REFERER)) $referer = "--- No Referer ---"; else $referer = $HTTP_REFERER; fputs($fp, "$time | $REMOTE_ADDR | $referer\n"); fclose($fp); } } // end func /** * Fonction inscrivant les uploads dans un fichier log (logs/uploads) */ function logUpload() { global $REMOTE_ADDR; global $fichier_name; global $login; global $dossier_destination; if(empty($login)) $login_log="NO LOGIN"; else $login_log = $login; $time = date("j/m/y - H:i", time()); $fp = @fopen("logs/uploads.log", "a+"); if($fp){ fputs($fp, "$time | $REMOTE_ADDR | $fichier_name | $login_log | $dossier_destination\r\n"); fclose($fp); } } /** * Fonction inscrivant les erreurs dans un fichier log (logs/errors) */ function logError($error) { global $REMOTE_ADDR; global $fichier_name; global $login; if(empty($login)) $login_log="NO LOGIN"; else $login_log = $login; $time = date("j/m/y - H:i", time()); $fp = @fopen("logs/errors.log", "a+"); if($fp){ fputs($fp, "$time | $error | $REMOTE_ADDR | $fichier_name | $login_log\n"); fclose($fp); } } // end func /** * Fonction faisant un "retour" en html */ function makeReturn() { global $strReturn, $strCloseWindow; echo "
".$strReturn." | ".$strCloseWindow."
"; } /** * Fonction de fermeture de l'application * Function that close the application */ function CloseUpload(){ global $closeApp; global $optionClosed; global $redirectionPage; global $messageIfClosed; if($closeApp==0){ if($optionClosed=="redirect"){ header("Location:$redirectionPage"); exit; }elseif($optionClosed=="message"){ echo $messageIfClosed; exit; } } } /** * Fonction d'authentification * Authentification function */ function AuthentificationUser($login, $pass, $user){ global $strBadLogin; $identok = false; $motif = $login."|".$pass; if(in_array($motif, $user)) $identok = true; if($identok==false){ echo $strBadLogin; logError("Bad Login or Pass ($login - $pass) "); makeReturn(); exit; } } /** * Fonction de verification du fichier * File chackinf function */ function FileChecking($fichier_name, $fichier_size){ global $strErrorExtension; global $strErrorFilesize; global $taille_max; global $fileExtensionsAllowed; ereg("\.([^\.]*$)", $fichier_name, $elts); $extension_fichier=$elts[1]; if(!in_array($extension_fichier, $fileExtensionsAllowed)){ foreach($fileExtensionsAllowed as $ext){ $str_ext .= ".$ext "; } echo $strErrorExtension." ".$str_ext."

"; logError("Bad File extension ($extension_fichier) "); makeReturn(); exit; } if($fichier_size > $taille_max){ echo $strErrorFilesize."

"; logError("File Size ($fichier_size) "); makeReturn(); exit; } } /** * Display the login form * Affiche le formulaire d'authentification */ function DisplayLoginForm() { global $strPassword; echo ""; echo "Login :"; echo "".$strPassword." "; echo ":"; } /** * Display the directory selection form */ function DisplayDirSelect(){ global $strDestDirectory; global $ftp_rep_choix; echo ""; echo $strDestDirectory." :"; echo ""; } /** * Display the end of the form */ function DisplayEndForm(){ global $strFileToUp; global $strWait; echo ""; echo $strFileToUp.""; echo "

"; echo ""; echo "

"; } /** * Display the begining of the form */ function DisplayBeginningForm(){ global $strUploadAFile; echo "
"; echo ""; echo ""; } /** * Function that rename the uploaded file */ function RenameFile($fichier_name){ global $renamed; $chaine_type = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; srand((double)microtime()*1000000); $code = ''; for($i=0; $i<5; $i++) { // on génère un code de 8 caractères aléatoirement $code.= $chaine_type[rand()%strlen($chaine_type)]; } $newFileName = $code.$fichier_name; $renamed = true; return $newFileName; } /** * Function that verify you have the FTP extensions for PHP loaded */ function DetectFtpExtension(){ $extensions = get_loaded_extensions(); if(!in_array("ftp", $extensions)) return false; else return true; } ?>e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.

"; echo "".$strUploadAFile."




 


DISEÑO DE HERRAMIENTAS PARA PORTAL DE GESTIÓN DE CENTROS DOCENTES

: Leiva Jiménez, Andrés
: Ingeniería Telecomunicación
Contenido del proyecto:
Directorio raíz  >  proyecto  >  proyecto  >  per_doc  >  administrador  >  includes  >  fonctions.inc.php