nidhikayadav
08-05-2008, 09:53 AM
How to hide the download URL in a self made application, so that the user cannot see the actual location from which he is downloading.
Thanks
Nidhika
Thanks
Nidhika
|
||||
Hide the download URLnidhikayadav 08-05-2008, 09:53 AM How to hide the download URL in a self made application, so that the user cannot see the actual location from which he is downloading. Thanks Nidhika rangana 08-05-2008, 09:59 AM You think it's useful? window.status='Secret'; After abduraooft's response, it made sense. abduraooft 08-05-2008, 10:06 AM http://www.codingforums.com/showthread.php?t=145600 may help you! ssonawa 08-05-2008, 11:17 AM Following code is easy to understand based on following logic: <a href="<?=$_SERVER['PHPSELF']?>?id=1">Google</a> <a href="<?=$_SERVER['PHPSELF']?>?id=2">MySpace</a> <a href="<?=$_SERVER['PHPSELF']?>?id=3">Yahoo</a> <a href="<?=$_SERVER['PHPSELF']?>?id=4">Rediff</a> <a href="<?=$_SERVER['PHPSELF']?>?id=5">SourceForge</a> $id = (isset($_GET["id"])) ? strval($_GET["id"]) : "1"; // lookup - write actual download location here $url[1] = 'http://www.google.com'; $url[2] = 'http://www.myspace.com'; $url[3] = 'http://www.yahoo.com'; $url[4] = 'http://www.rediff.com'; $url[5] = 'http://www.sourceforge.net'; header("Location: $url[$id]"); Take a look : <? //Give actual path here if(isset($_GET['file'])){ $file = $_GET['file']; } $secretPath = "C:/Documents and Settings/sonawaso/Desktop/"; $file_real = $secretPath.$file; if (file_exists($file_real)){ // Get extension of requested file echo $extension = strtolower(substr(strrchr($file, "."), 1)); // Determine correct MIME type switch($extension){ case "avi": $type = "video/x-msvideo"; break; case "exe": $type = "application/octet-stream"; break; case "mov": $type = "video/quicktime"; break; case "mp3": $type = "audio/mpeg"; break; case "mpg": $type = "video/mpeg"; break; case "mpeg": $type = "video/mpeg"; break; case "rar": $type = "encoding/x-compress"; break; case "txt": $type = "text/plain"; break; case "wav": $type = "audio/wav"; break; case "wma": $type = "audio/x-ms-wma"; break; case "wmv": $type = "video/x-ms-wmv"; break; case "zip": $type = "application/x-zip-compressed"; break; case "asf": $type = "video/x-ms-asf"; break; default: $type = "application/force-download"; break; } // Fix IE bug [0] $header_file = (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1) : $file; // Prepare headers header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public", false); header("Content-Description: File Transfer"); header("Content-Type: " . $type); header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=\"" . $header_file . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . filesize($file_real)); // Send file for download if ($stream = fopen($file_real, 'rb')){ while(!feof($stream) && connection_status() == 0){ //reset time limit for big files set_time_limit(0); print(fread($stream,1024*8)); flush(); } fclose($stream); } }else{ // Requested file does not exist (File not found) echo("Requested file does not exist"); die(); } ?> Refer this link http://www.webmasterworld.com/php/3580368.htm this script checks for hacking attempt. |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum