Want a really simply file directory viewer? Take out the comments and it's obfuscated!
<?php
// grab a full file listing from the current and sub directories and show them as anchored
//(linked) files.
// pull a full file listing - requires the Unix 'find' and 'sort commands. 'find' will retrieve a
//list of all files from the current directory, 'sort' will sort the listing, and 'explode' will split
//all files into an array passed into $filelist.
$filelist = explode("\n",`find .|sort`);
// for each item (file) in the array...
for ($count=0;$count<count($filelist);$count++) {
// get the filename (including preceding directory, ie: ./software/gth1.0.9.tar.gz)
$filename=$filelist[$count];
// if it's not a directory, display linked
if (!is_dir($filename))
printf("<a href=\"%s\">%s</a><br>\n",$filename,$filename);
Ronny Vaardal wrote :403
HI.. nice script.. Just what I was looking for.
Now what I did, was this... :)
I placed a symbolic directory as a subdirectory of the
html-directory, that points to my mounted mp3 directory
located in the ftp directory (phju.. :) Then, I modifed
your script a bit...
At the top, I added a chdir("./mp3"); to go into this
symbolic directory.
Then I made a str_replace in the $filelist to remove the
beginning "./" on each file. Looks like this now:
So with a tiny modification, I can now list my ftp server`s
mp3 catalog with php, and make a list of anchors on a
http page. I`m proud since this is one of my first scripts.
Next I will do an individually download/counter for each
file, and a top20 downloaded page :)
All of this to be my "computer gathering" way of sharing
what I got :)
And again.. thnx. man! Your a life saver I guess :)
saif slatewala wrote :1043
hi thks a lot awesome script ... save me some time ;)
lucas seiden wrote :1638
hm this dosent work for me. i just copied it to try it out for the first time and i get a security warning.
"Warning: shell_exec() has been disabled for security reasons in /www/htdocs/w006ecb7/listfiles.php on line 18"
line 18 seems to be the explode funtion one. is there an alternative to this?