Ok, I didn't know exactly how to describe what I'm looking to do. I currently have a file (download.php) which tracks the clicks to download games, and then directs to the exe for download. My current linking method is download.php?id=x, and used by itself redirects to a blank white page, and then prompts to save the game. In order to not throw people off, I've targeted the link to a new window which then prompts for download, so at least my site will still be there.
Here's my download.php:
// connection here
$result = mysql_query("select * from game_downloads WHERE game_id='$id'");
$update = "UPDATE game_downloads SET hits='$hits' WHERE game_id=$id";
$updatesql = mysql_query($update);
But now clicking a download link brings the save prompt right up, with the right header() call. I didn't want to actually "force" a download on somebody.
Originally posted by Rich2k To FORCE a download you should use the 'Content-disposition' header. This works on all browsers I know of.
This is true but be very careful with it, either create an array of the files you want to allow to be downloaded or mabye create a table for them in MySQL and call them from an id number, i've seen people leave scripts open for others to just call http://domain.com/download.php?get=anyfileyouwant.php