| [ PHPXref.com ] | [ Generated: Sun Jul 20 17:00:47 2008 ] | [ Clide 1.4.1 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?PHP 2 3 /* 4 * Project: Clide FTP 5 * File: dynamic.php 6 * Author: Absynthe <absynthe.is@free.fr> 7 * Version: 1.4.1 @ 25/06/2006 8 * License: GPL 9 * 10 * The lastest version of Clide FTP can be obtained from: 11 * http://clide.is.free.fr/ 12 * 13 * You can visit the forum about Clide FTP at: 14 * http://clide.is.free.fr/forum/ 15 */ 16 17 /* 18 * Ce fichier a pour but d'afficher une image prise aléatoirement 19 * dans le fichier indiqué dans l'URL, par exemple: 20 * http://absynthe.is.free.fr/dynamic.php/Avatar/ affichera aléatoirement 21 * les images contenues dans le sous-dossier "Avatar" contenue dans le dossier 22 * "root" du script. Ainsi, vous disposerez d'un avatar dynamique sur vos 23 * sites et forums favoris en signalant ce type d'URL comme avatar. 24 * 25 * Pour les forums, il est généralement demandé que l'URL pointe bien vers 26 * une image et pas vers un fichier. Pour contourner cette restriction, rajoutez 27 * "?images.jpg" à la fin de l'URL pour leurer le forum: 28 * http://absynthe.is.free.fr/dynamic.php/Avatar/?images.jpg 29 */ 30 31 32 // Inclusion des fichiers 33 require_once ('./system/config.php'); // Fichier de configuration 34 require_once ('./system/fonctions.php'); // Fichier de fonction 35 36 // Initialistaions des variables 37 $url = $_SERVER['PATH_INFO']; 38 $url = current(explode("?", $url)); 39 $path = "$root"."$url"; 40 $path = urlddecode($path); 41 $count = 0; 42 43 // Lecture du dossier 44 if ($handle = opendir(".$path")) 45 { 46 while ( false !== ($file = readdir($handle)) ) 47 { 48 $file_extension = end( explode('.', $file) ); 49 50 if (eregi('(gif|png|jpg|jpeg|bmp)',$file_extension)) 51 { 52 $files[$count] = $file; 53 $count++; 54 } 55 } 56 closedir($handle); 57 } 58 59 $rand = rand(0,$count-1); 60 61 if ($count == '0') 62 { 63 echo "Pas d'images dans ce dossier."; 64 } 65 else 66 { 67 // Initialisation du header 68 switch(strtolower(end(explode('.', $files[$rand])))) 69 { 70 case "gif": $header = "image/gif"; break; 71 case "jpg": $header = "image/jpg"; break; 72 case "jpeg": $header = "image/jpeg"; break; 73 case "png": $header = "image/png"; break; 74 case "bmp": $header = "image/bmp"; break; 75 } 76 77 // Lecture du fichier 78 header("Content-type: $header"); 79 readfile(".$path$files[$rand]"); 80 } 81 82 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |