<?php

   
       // echo $_POST["download_filename"];
    
      
       //echo "cretin";

       

      // $path = "/home/analogde/www/Fusion/File explorer";
      // $dl = "Kate-Upton.jpg";



// fetch file to download from database
//$sql = "SELECT * FROM  upload_files WHERE ID=$id";
//$result = mysqli_query($conn, $sql);
// Now update downloads count
//$newCount = $file['DOWNLOAD'] + 1;
//$updateQuery = "UPDATE upload_files SET DOWNLOAD=$newCount WHERE ID=$id";
//mysqli_query($conn, $updateQuery);
//exit;

/*
CREATE TABLE download_history (
    
    id int(11) NOT NULL,
    `email_address` text NOT NULL,
    `action` varchar(100) NOT NULL,
    `actions` varchar(200) NOT NULL DEFAULT 'Has LoggedOut the system at',
    `ip` text NOT NULL,
    `host` text NOT NULL,
    `login_time` varchar(200) NOT NULL,
    `logout_time` varchar(200) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  */

  // autoincrement


       $path = $_GET["path"];
       $dl = $_GET["file"]; 

       header('Content-Description: File Transfer');
       header('Content-Type: application/octet-stream');
       header('Content-Disposition: attachment; filename="' . basename($path . '/' . $dl) . '"');
       header('Content-Transfer-Encoding: binary');
       header('Expires: 0');
       header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
       header('Pragma: public');
       header('Content-Length: ' . filesize($path . '/' . $dl));
       ob_clean();
       flush();
       //readfile($filepath);

     
       readfile($path . '/' . $dl);

       //echo "<script type="text/JavaScript">  alert('pipo')  </script>' ; 

      // echo " +++++ " .$_POST["champ"];
       exit;
    
?>



























































