i'm new at PHP Programming. So I Have a big question:
My Problem is that I will have a button for example:
<a href="/upload_crypt.php?id=370&snrid=123456">PDF Download</a>
I will use this upload_crypt.php file to get my complete link back. This Link must be set as a header request so that the User can not see the full path and the pdf is show to safe by the browser.
In my upload_crypt.php file I have the following code:
<?php
include_once("db.inc.php");
include_once("db_connect.inc.php");
@session_start();
$snrid = $_GET['snrid'];
$id = $_GET['id'];
$sql_query4 = 'SELECT * FROM web_osc_uploads WHERE Section = "Schaden" AND DocType = "pdf" AND DocDesc = "Kaufbeleg" AND IdentValue = "'.$_GET['snrid'].'" AND ID = "'.$_GET['id'].'"';
$sql_result4 = mysqli_query($mysql, $sql_query4);
$sql_row4 = mysqli_fetch_object($sql_result4);
$filename = $sql_row4->Filename;
$Url_string = 'upload/'.$snrid.'/'.$id.'/'.$filename.'';
if($id != ''){
if (!file_exists('../upload/'.$snrid.'/'.$id.'/'.$filename)) {
header('Content-Type: application/pdf');
// Es wird downloaded.pdf benannt
header('Content-Disposition: inline; filename='.$filename.'');
// Die originale PDF Datei heißt original.pdf
readfile('../upload/'.$snrid.'/'.$id.'/'.$filename);
}
}else{}
?>