PHP Classes
elePHPant
Icontem

Little Leach: Serve files protected from direct download

Recommend this page to a friend!
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2008-09-28 (8 years ago) RSS 2.0 feedNot enough user ratingsTotal: 437 All time: 5,949 This week: 1,109Up
Version License PHP version Categories
little_leach 0.7GNU General Publi...5HTTP, PHP 5, Files and Folders
Description Author

This class can be used to serve files protected from direct download.

It sets a session variable with the name of file that is made available for download from a page link.

The class can serve the file for download only if it is session variable is set, thus preventing that file be download directly without going to the page with the download link.

Picture of Andrey Nikishaev
Name: Andrey Nikishaev <contact>
Classes: 13 packages by
Country: Ukraine Ukraine
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

Details
- place .htaccess file to the directory which you want to lock
- pathes to the locked directorys must be writed from the server document root directory 

new leach($pathes) - creates Leach and give to him pathes of the directorys where it must search files.
leach->setAccess() - give access to the file. It write filename to the Session vars. So he know whether user goes to it throught direct link or not.
leach->getFile($filename,$dirname) - get's the file. Where filename - name of the file and dirname - name of the locked directory from the pathes array. If it null, Leach will search file in all listed directorys.
  Files folder image Files  
File Role Description
Accessible without login Plain text file getfile.php Example example
Accessible without login Plain text file leach.php Example example
Accessible without login Plain text file README.TXT Doc. Installation readme
Plain text file .htaccess Conf. file access for Apache
Accessible without login Plain text file little_leach.php Class class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:437
This week:0
All time:5,949
This week:1,109Up