|
|
|
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 | | | Variable serialization and unserialization. Loading and saving variable structures
to and from file. Categories : Arrays, Filesystem, Variables, Strings, PHP | | | 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 TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML - Categories : PHP, Directories, FTP, Filesystem, HTML and 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 | | | Single-file PHP news system with automatic folder structure creation Categories : PHP, Filesystem, Arrays | | | getDirArray(Path,Filter,Sorted): Returns an array of the files in a directory,
filtered by regular expression and either sorted or randomized. Good for
random pictures and graphics. Categories : PHP, Filesystem, Directories | | | Grab images from one or more URLs and save them to a specified local directory. Categories : PHP, Filesystem, Strings, Arrays | | | Listing the 10 most recently updated files in a given dir by using last-
modified variable and printing to html with link to the file Categories : PHP, Directories, Filesystem | | | 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 | | | 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 | | | Using PHP to Delete a directory with all sub directories and files using FTP Categories : PHP, FTP, Directories, Filesystem | | | PHP4 DirectoryIterator Class Categories : PHP, PHP Classes, Filesystem, Directories | | | This script will read all images from a folder and read the files into an array. It uses rand() to get a random number. It will display a random image from the image folder given. Categories : PHP, Arrays, Graphics, Filesystem | |
| | | | 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?
| |
|
|