Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Hide the download URL

    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

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    You think it's useful?
    Code:
    window.status='Secret';
    Edit:
    After abduraooft's response, it made sense.
    Last edited by rangana; 08-05-2008 at 10:17 AM.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    rangana (08-05-2008)

  • #4
    New Coder
    Join Date
    Jul 2008
    Location
    India
    Posts
    39
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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 :

    PHP Code:
    <?
    //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'$filesubstr_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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •