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    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 439 All time: 6,199 This week: 327Up
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 is available for providing paid consulting. Contact Andrey Nikishaev .
Classes: 13 packages by
Country: Ukraine Ukraine
Age: 35
All time rank: 2546 in Ukraine Ukraine
Week rank: 540 Down9 in Ukraine Ukraine Down
Innovation award
Innovation award
Nominee: 2x

Winner: 1x


- 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  
This week:0
All time:6,199
This week:327Up

For more information send a message to info at phpclasses dot org.