ok i found this script that had more features i wanted off of php.net and i need help putting these two code snippets together i tried but im pretty sure it has to do with getting the url and title from the database so any help would be good
This is the Mysql table searching and getting
<?
include("connect.php");
if ($id) {//if an id has been queried then...
$go = MYSQL_QUERY("SELECT * FROM downloads WHERE id = $id");//define go as a query
if(!$go) { die("Error!"); }//if there is a problem, slit wrists
$home = MYSQL_FETCH_ARRAY($go);//define home
MYSQL_QUERY("UPDATE downloads SET count = count + 1 WHERE ID = $home[id]");//update table downloads, by adding 1 to the count of the id specified
MYSQL_FREE_RESULT($go);
}
// $home["url"] -get the url to dl
//$home["title"] -get the filename to rename the dl to
?>
amd here is the script im trying to integrate into it but like the last one it does no download correct cause its file size is 0kbs
// $home["url"] is the url to the file download
//$home["title"] is what i want the file name to the download i want to be
<?php
function send_file($name) {
ob_end_clean();
$path = "protected/".$name;
if (!is_file($path) or connection_status()!=0) return(FALSE);
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Content-Type: application/octet-stream");
header("Content-Length: ".(string)(filesize($path)));
header("Content-Disposition: inline; filename=$name");
header("Content-Transfer-Encoding: binary\n");
if ($file = fopen($path, 'rb')) {
while(!feof($file) and (connection_status()==0)) {
print(fread($file, 1024*8));
flush();
}
fclose($file);
}
return((connection_status()==0) and !connection_aborted());
}
?>
Please help im starting to get php more by more but i do not know how to work this out