Hello All

I need to allow a user to access a PDF file, only if he/she is logged in as a registered user. So here is the code that I am trying to use. I have been able to make this work in the past, when I had to read .html file, now since the file in question is a .pdf file, I am having trouble. The browser shows a long list of weird characters instead of the pdf file


if(session_is_registered("user_valid")){ $filepath ="docs/any_file.pdf"; $h1 = @fopen($filepath,"r"); while (!feof($h1)) { $a = fread($h1,4096); echo "$a"; } }

Any ideas / suggestions would be welcome. Thanks in advance

Pushpinder




Reply via email to