Posted by: prajapatinilesh | August 8, 2007

List files in dir

<?php
echo ‘<h1>Index of /adult/</h1>’;
echo ‘<ul>’;
echo ‘<li><a href=”/”> Parent Directory</a></li>’;

$dir = scandir(‘.’);
$files = count( $dir );
for ( $i = 0; $i < $files; $i++ )
{
if ( is_file($dir[$i]) && strlen( $dir[$i] ) <= 36 && ( strstr( strtolower( $dir[$i] ), ‘.htm’ ) ||  strstr( strtolower( $dir[$i] ), ‘.html’ ) ||  strstr( strtolower( $dir[$i] ), ‘.php’ ) ) )
echo “<li><a href=\”$dir[$i]\”>$dir[$i]</a></li><br>”;

if ( is_dir($dir[$i])  && $dir[$i] != “.” && $dir[$i] != “..” && $dir[$i] != “adult” )
echo “<li>FOLDER – !!!! <a href=\”$dir[$i]\”/>$dir[$i]/</a></li><br>”;
}

echo ‘</ul>’;
?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: