|
|
|
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);
// otherwise tell the user it's a "category"
else printf("<p>Category: %s<p>\n",$filename);
}
?>
|
|
| A function which places the path and name of all subdirectories into an array Categories : PHP, Filesystem, Arrays, Directories | | | Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
Categories : PHP, Directories, Variables, Arrays | | | Extended Get File List Function Categories : PHP, Filesystem, Search, Directories | | | How to ifconfig down/up a list of IP's Categories : Arrays, Strings, Filesystem, PHP | | | Single-file PHP news system with automatic folder structure creation Categories : PHP, Filesystem, Arrays | | | Filling an array with files from any given directory. This example is for the current PHP script's directory. Categories : PHP, Arrays, Filesystem | | | Grab images from one or more URLs and save them to a specified local directory. Categories : PHP, Filesystem, Strings, Arrays | | | Variable serialization and unserialization. Loading and saving variable structures
to and from file. Categories : Arrays, Filesystem, Variables, Strings, PHP | | | a file explorer for the web, filesystem php php3 files dirs directories pictures files windows linux system list ls scripts Categories : PHP, URLs, Directories, Filesystem | | | Compare two texts and display a block of text with the differences between them. Categories : PHP, PHP Classes, Filesystem, Strings, Arrays | | | grab directory listings into an array the example prints out each
subdirectory in the main dir - further work is to be performed on this one Categories : Filesystem, PHP, Directories, Search, Utilities | | | Directory Viewer, Directory Content Viewer, Directory Structure to HTML.
This code will basically create a complete set of HTMLs to let a user
navigate through any directory you want. Excellent code for large file
sharing pages. Categories : Directories, Filesystem, PHP | | | PHP4 DirectoryIterator Class Categories : PHP, PHP Classes, Filesystem, Directories | | | List the content of the directory of your webserver where this small PHP Script resides. Categories : PHP, Filesystem, Directories, CSS | | | Directory viewer, customize how you display the file structure, easy to
understand. Found out about PHP 3 days ago, and this is my first prog. Categories : HTML and PHP, Complete Programs, Directories, Filesystem, PHP | |
| | | | 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:
$filelist = explode("\n", str_replace("./","",`find .|sort`));
further on the anchor part looks like this, to point the
browser towards the ftp, and not the http:
printf("<dd><a href=\"ftp://ftp.domain.com/mp3/%
s\">%s</a></dd>\n",$filename,$filename);
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?
| |
|
|
|