Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ok so I first check isset for the session to check if the user is logged in, I added inside an a tag href="?pdf" then i run the following php
- $fullUrl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
- if (strpos($fullUrl, "pdf") == true){
- { $pdf = file_get_contents("www.example.com/pdffolder/example.pdf");
- header("Content-type: application/octet-stream");
- header("Content-disposition: attachment;filename=example.pdf");
- echo $data; }
- I then added this htaccess
- RewriteEngine On
- RewriteBase /
- RewriteCond %{REQUEST_FILENAME} ^.+\.pdf$
- RewriteRule .* - [F,NS,L]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement