Login   Register  
PHP Classes
elePHPant
Icontem

File: leach.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrey Nikishaev  >  Little Leach  >  leach.php  >  Download  
File: leach.php
Role: Example script
Content type: text/plain
Description: example
Class: Little Leach
Serve files protected from direct download
Author: By
Last change: setup execution time up to 10 hours.
Date: 6 years ago
Size: 762 bytes
 

Contents

Class file image Download
<?php
ini_set
('max_execution_time','36000');
session_start();

include(
'little_leach.php');
//pathes to the locked directorys starts from the server document root
$pathes=array(
    
'img'=>'/img/',
    
'files'=>'/upload/'
);
$a=new Leach($pathes);
//$filename - it's the name of the file that Leach searchs in the locked directorys
$filename=$_REQUEST['f'];
if(!
$filename) die("File doesn't exists");
    if(
array_key_exists('leach',$_SESSION) && in_array($filename,$_SESSION['leach'])) {
        
$a->getFile($filename);
                
//also you can get file from the specified directory
                //like that $a->getFile($filename,'img');
                //where 'img' is the name of the path;
    
} else {
        die(
"You don't have permission.");
    }