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/download1.zip");
break;
case 2:
header("Location: ./hidden--files/download2.zip");
break;
default:
echo "No file found with that id";
}
exit();
} else {
echo "Please specify a file ID";
}
?>
However, this doesn't work. What I want is something like: when I access the URL http://example.com/download.php?file_id=1 , a download of http://example.com/hidden--files/download1.zip will come up but without displaying where the file is. How can I do this?
Thanks in advance,
-jk
Ps. I have searched this site and came across this thread, but I'm hoping to leave databases out of it because I don't want to complicate it further (and I'm a bit confused by that thread anyway).