Here is my link script:
include('dbinfo.inc.php');
include('css.php');
$query = mysql_query("SELECT * FROM scripts WHERE type='gnu'") or die(mysql_error());
$num = mysql_num_rows($query) or die(mysql_error());
for($i=0; $i<$num; $i++){
$fetch = mysql_fetch_array($query) or die(mysql_error());
$name = $fetch['name'];
$descrip = $fetch['descrip'];
$downloads = $fetch['downloads'];
$mysql = $fetch['mysql'];
$type = $fetch['type'];
$filename = $fetch['filename'];
$cat = $fetch['cat'];
$id = $fetch['id'];
echo "<br> <b><a href='download.php?file=$id' target='_blank'>$name </a></b>.::. <b>Category:</b> $cat .::. <b>MySQL Needed:</b> $mysql .::. <b>Downloads:</b> $downloads <br> <b>Description:</b> $descrip <br><br>";
}
Here is my download.php page
<?
include('dbinfo.inc.php');
$id = $HTTP_GET_VARS['file'];
$filename = mysql_query("SELECT filename FROM scripts WHERE id='$id'") or die(mysql_error());
mysql_query("UPDATE scripts SET downloads=downloads+1 WHERE id='$id'") or die(mysql_error());
header("Content-Disposition: attachment; Content-Type: application/octet-stream; filename='scripts/$filename'");
?>
Hope that sheds some light. Thanks!