add pdf download

This commit is contained in:
Andrey Kuvshinov
2020-04-07 18:34:49 +03:00
parent 2c291305a6
commit bfbed2a2d1

View File

@@ -14,22 +14,24 @@ function priceid_kuri($id){
function file_kuri($hash) {
$price = db_get("SELECT `pricename` FROM price WHERE `pricehash` = $hash LIMIT 1");
$price = db_get("SELECT `price_id`, `pricename` FROM `price` WHERE `pricehash` = '$hash' LIMIT 1");
if (!isset($price['price_id'])){
header("HTTP/1.0 404 Not Found");
echo "file not found";
return False;
}
$id = $price['price_id'];
$pdfile = "/vhosts/an/httpdocs/files/pdf/pdf/$id.pdf";
$pdfile = "/vhosts/an/httpdocs/pub/files/pdf/pdf/$id.pdf";
$request = $_SERVER['REQUEST_URI'];
$filename = basename($request);
if (!file_exists($pdfile)) {
header("HTTP/1.0 404 Not Found");
return false;
echo "file not found";
return false;
}