Re: Routing downloads through PHP

From: Date: Wed, 15 Feb 2006 04:04:17 +0000
Subject: Re: Routing downloads through PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-230404@lists.php.net to get a copy of this message
On Tue, Feb 14, 2006 at 09:02:50PM +0000, J_K9 wrote: > Hi, > > I'm currently learning PHP, and I'd like to put it into practice to help > me learn. I want to make a download script so that if the value of a > certain variable is '1', the first download is selected, if it's '2', > the second is selected, and so on... But, all the time, the download > source's URI is not revealed. > > As I was saying, I have a vague idea of how to do it - but I know it's > wrong. With the help of some others, I've managed to come up with this: > > |----------------------- > ||<?php > > if(!empty($_GET['file_id'])) { > > switch ($_GET['file_id']) { > case 0: > echo "Please specify a file ID"; > case 1: > header("Location: ./hidden--files/downloadme.zip"); > break; > ... This is a method is rather known as 'security by obscurity'. If you want to use this method instead of doing some sort of authentication system, you need to make your file_id's more obscure by using a more randomized value instead of 1,2,3... Curt. -- cat .signature: No such file or directory

« previous php.general (#230404) next »