Visa ett inlägg
Oläst 2006-12-18, 10:10 #5
DeSotos avatar
DeSoto DeSoto är inte uppkopplad
Flitig postare
 
Reg.datum: Oct 2005
Inlägg: 323
DeSoto DeSoto är inte uppkopplad
Flitig postare
DeSotos avatar
 
Reg.datum: Oct 2005
Inlägg: 323
Kanske inte den snyggaste koden, men den fungerar:
Kod:
<?php
$realpath = dirname( __FILE__ ) .'/';
if( isset( $_GET['path'] ) )
{
   $path = str_replace( '.', '', $_GET['path'] );
   if( is_dir( $realpath . $path ) )
   {
     $realpath .= $path;
     $realpath = rtrim( $realpath, '/' ) .'/';
   }
}

foreach( glob( $realpath .'*' ) as $file )
{
   $file = str_replace( dirname( __FILE__ ) .'/', '', $file );
   if( is_dir( $file ) )
   {
     echo '<a href="files.php?path='. $file .'">'. $file .'<br />';
   }
   else
   {
     echo '<a href="'. $file .'">'. substr( $file, 0, strrpos( $file, '.' ) ) .'<br />';
   }
}
?>
Förutsätter att filen du lägger koden i heter files.php.
DeSoto är inte uppkopplad   Svara med citatSvara med citat