Blame | Letzte Änderung | Log anzeigen | RSS feed
<!-- Whizzylink.phpCopyright © 2006, John Goodman - john.goodman(at)unverse.net *date 060307This 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.A copy of the GNU General Public License can be obtained at: http://www.gnu.org/licenses/gpl.htmlPARAMETERS are optional:d=start directorydefault is the root directoryx=list of file extensions to consider, separated by '|'default is htm|html|txt|doc|xls|ppt|pdf|cfm (NB asp|php|shtml Not included in default)b=path to button imagesdefault is /btne.g. whizzylink.php?d=publicpages&x=html|pdf|php--><html><head><title>Whizzylink link browse v4</title><style>body {font:85% sans-serif;}</style><script type="text/javascript">function WantThis(url) {window.opener.document.getElementById('lf_url').value = url;window.close();}</script><META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW"></head><body><div id="files" >Click a name below to select.<br><?php$butpath = $_REQUEST['b'] ? $_REQUEST['b'] : '/btn';$extensions = $_REQUEST['x'] ? '/\.(' . $_REQUEST['x'] .')$/i' : '/\.(htm|html|txt|doc|xls|ppt|pdf|cfm)$/i';$docpath = trim($_REQUEST['d'],"/");$d = $_SERVER['DOCUMENT_ROOT'] . '/' . $docpath;$dir = opendir($d);while ($file = readdir($dir)){$files[] = $file;}closedir($dir);natcasesort($files); //see function insensitive($a, $b)foreach ($files as $filename) {$filepath = "$d/$filename";if (@is_dir($filepath)) { //it's a directoryif ($filename == '.'){ //current directory$dlist .= "<img src='".$butpath."/dir.gif'> $docpath ";} else if ($filename == '..') { //parent directoryif($docpath) { //we're in a sub directory - no Up from root$updir = substr($docpath,0,strrpos($docpath,'/'));$dlist .= "<img src='".$butpath."/back.gif'><a href='$self?d=$updir'>Up</a>/<br>";}} else {//$docpath = str_replace($_SERVER['DOCUMENT_ROOT'], "", $d);//NEEDED?$dlist .= "<div style='float:left;width:20em'><img src='".$butpath."/dir.gif'><a href='$self?d=$docpath/$filename'>$filename</a></div>";}} else if (preg_match($extensions,$filename) || strpos($filename,'.') === false) { //hide forbidden extensions$flist .= "<div style='float:left;width:20em'><a href='#' onclick='WantThis(\"$docpath/$filename\")'>$filename</a></div>"; //it's a potential link}}echo $dlist . $flist;?></div></body></html>