Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $file="9276dac4e6735f8b50b6857414292b31";//ini diambil pake $_GET
- $_SESSION['authenticated']="download_pause";//ini ada di page sebelumnya
- $query="SELECT * FROM com_download_dt";
- $query = mysql_query ($query) or die (mysql_error());
- while ($dataFile = mysql_fetch_array($query))
- {
- if($file==md5($dataFile['file'])){
- if (!isset($_SESSION['authenticated']))
- {
- echo' <h1 class="page-header">Restricted</h1>
- <div class="progress">
- <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 0%;-webkit-transition: none !important;transition: none !important;"></div>
- <meta http-equiv="refresh" content="3; url=//localhost/website/folder/" />
- </div>';
- }
- elseif ($_SESSION['authenticated']=="download_pause")
- {
- echo' <h1 class="page-header">Downloading</h1>
- <div class="progress">
- <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 0%;-webkit-transition: none !important;transition: none !important;"></div>
- <meta http-equiv="refresh" content="3; url=//localhost/website/download/'.md5($dataFile['file']).'" />
- </div>';
- $_SESSION['authenticated']="download_start";
- }
- elseif ($_SESSION['authenticated']=="download_start")
- {
- session_destroy();
- $_SESSION['authenticated']="";
- $fileN = $_SERVER['DOCUMENT_ROOT'].'/hipki/uploads/files/'.$dataFile['file'];
- header('Content-Description: File Transfer');
- header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename=' . basename($fileN));
- 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($fileN));
- ob_clean();
- flush();
- readfile($fileN);
- exit;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement