callng non-web accessible files (pdf's)
Posted: Mon Oct 11, 2010 12:46 pm
Hi guys,
I am fairly new to php and whilst I understand how to put together a login function - once it goes past there I really start to struggle! I was hoping one of you guru's can help me out!
Basically - I have a website with 100 members who each have a password protected page. Each month I want to give each member a link to a PDF that is specific to them. They cannot view anyone elses PDF but their own. Having researched - I sussed out that the best way to do this is to store the PDF's in a non-web accessible folder and use php to deliver the PDF when the relevant link is clicked by the user. Knowing I have to do this and delivering are 2 different things though!
This would be the path:
1/ User clicks link on his page ie: "Barry's PDF number 1"
2/ Link goes to PHP page that checks that the user is logged in (I have this script from the original login) and then checks it against the requested PDF
3/ PDF is delivered to the server.
It may sound like I know what im doing but am totally confused about the code it takes to implement this! Am I right in thinking that I need to use the php INCLUDE function to call the PDF's? If any one can give me an example of how it would look I would be forever grateful!
I am fairly new to php and whilst I understand how to put together a login function - once it goes past there I really start to struggle! I was hoping one of you guru's can help me out!
Basically - I have a website with 100 members who each have a password protected page. Each month I want to give each member a link to a PDF that is specific to them. They cannot view anyone elses PDF but their own. Having researched - I sussed out that the best way to do this is to store the PDF's in a non-web accessible folder and use php to deliver the PDF when the relevant link is clicked by the user. Knowing I have to do this and delivering are 2 different things though!
This would be the path:
1/ User clicks link on his page ie: "Barry's PDF number 1"
2/ Link goes to PHP page that checks that the user is logged in (I have this script from the original login) and then checks it against the requested PDF
3/ PDF is delivered to the server.
It may sound like I know what im doing but am totally confused about the code it takes to implement this! Am I right in thinking that I need to use the php INCLUDE function to call the PDF's? If any one can give me an example of how it would look I would be forever grateful!