Developing an Admin page, in which admins uploads PDF and user downloads that PDF. After user downloads PDF, the PDF has to ask password, how to set password for that PDF automatically in php and that PDF should not set by Admin
This is my Admin Page Code
move_uploaded_file($tmp_name, $location);
if (copy($location, $location1)) {
$query = mysqli_query($conn, "SELECT * FROM `at_uploads` WHERE name='$name1'");
if (mysqli_num_rows($query) > 0) {
echo("<SCRIPT LANGUAGE='JavaScript'>
window.alert('File already exists with that name')
window.location.href='upload';
</SCRIPT>");
}
}
This is my user download page
if(isset($_GET['dow'])) {
$filepath1 = $_GET['dow'];
$query = mysqli_query($conn, "SELECT * FROM `at_uploads` WHERE filepath1 ='$filepath1'");
while (($row = mysqli_fetch_array($query))) {
$name=$row['name'];
$location = "C:/wamp/www/school/admin/files/" . $name;
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="' . basename($location) . '"');
header('Content-Length: ' . filesize($location));
readfile($location);
}
}
I don't know where to set password for pdf