(PHP 4, PHP 5) ldir – List files and directories inside the specified path.
Mixed ldir(string $directory[, array $hiddentypes[, array $hiddenfiles[, $GET]]])
The directory to be displayed (Absolute or Relative)
The filetypes (extensions) to hide i.e. .php Include “.?” to hide dot files/folders.
Individual files to hide. (The script hides itself (or anything with the same name [to fix]))
Deprecated in 1.8.0
Any additional GET variables to be passed. This allows ldir to be used with more complicated scripts. [Added in Version 1.7.0 onwards] [Deprecated in Version 1.8.0 onwards]
Returns echo’d HTML.
Returns bool true int 2 if there was a minor problem (folder/file permissions)
Returns bool true int 3 if there was a minor problem (cannot retrieve icons) Removed in 1.7.9
Returns bool true int 4 if it detects an injection attack (only for admin/logging use)
Returns false if there is any other problem i.e. Directory doesn’t exist.
Use === rather than == to determine which error code is produced.
NOTE: File sizes over 2GB maybe incorrect, see PHP Filesize
ob_start(); $types = array(".php",".exe",".?"); $files = array("index.php","README.txt"); .... code .... ldir("/location/to/folder",$types,$files);
[Folder] /location/to/files Type FileName Size [icon] filename/link filesize
Versions 1.6.6 onwards
- Covered by the GNU GPL v3
Versions Prior to 1.6.6
- No License but deemed as Gratis (like free Beer but not Free Speech) i.e. don’t edit the code!
- Improved the automatic $_GET parameter code.
- Added a HTML comment to display the microtime it took to generate the output.
- Deprecating the $GET parameter as it can be found via the $_SERVER superglobal
- Modified the method that ldir detects it’s own script name
- Shamelessly Added a Link Back (use CSS to hide .ldir_link)
- Speed optimisations
- Rewrote icon checking
- Added supported common icons list
- Suppressed header() / ob_flush() calls
- Fixed ‘parent folder’ link not working
- Speed Optimisations
- Removed/Condensed more code (9% smaller compared to previous version)
- Removed icon host check
- Added better support for styling – Removed inline width CSS & Added CSS styles for each column
- Removed some linebreaks.
- Removed/Condensed some code (upto 7% smaller)
- Custom UserAgent in CURL Opts.
- Changed the Update URL.
- Rewrote the PHP4 scandir support so its mildly faster
- Edited the file/folder checkingn system so its less resource hungry
- Added Support for different icon hosts
- Migrated icons to dropbox.
- Removed more legacy CSS that may have been an issue for users with custom CSS
- Capitialised the first character of the visible directory name / download location
- Changed the folder refresh method so it didn’t force a cache reload
- Changed strripos and stripos to strpos & stripos to make it PHP4 compatible (again)(See 1.7.3-1)
- Added a class to update text and refresh div so they can be hidden.
- Removed some legacy CSS forcing elements to be blue
Info and Downloads
Dependencies: PHP 4/5, PHP-cURL
License: GNU GPL v3
Version 1.4.0 (Legacy **)
*Requires Bug Fix 1.7.3-1 0.0.3 for PHP4
**Legacy Version was a non-function application written prior to the ldir development.