Hi!
Thank you for your reply! That was the code I have looked long.
Could you help one more thing?
I have a standard file download code, but in case I complete this code with session handling the file won't download, and I get the ASCII content of the file instead of the standard Windows download form. I need the session handling because i have to store the number of file downloaded in the database and I get the username and password from a form.
Could you help me?
Here is my code:
<?php
session_start();
echo $SESSION["user"];
echo $SESSION["pwd"];
if (isset($GET['src'])) {
$src = $GET['src'];
switch ($src) {
case 1: $fname = "file1.zip"; break;
case 2: $fname = "file2.zip"; break;
case 3: $fname = "file3.zip"; break;
default: header("offer.html"); //in case they typed something else in!
}
if (is_file($fname)) {
//This is where the download will start, so its a great
// place to add in your database code first while the
//script still has control!
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=$fname");
$fp = fopen($fname, 'rb');
fpassthru($fp);
}
}
else {
header("offer.html"); // no parameter, send them back to reselect !!
}
?>
Thanks!