You can create an unlimited number of content blocks and put them on your web pages. MySQL database is used to store all the content that you need to protect.
For each block of content, you set a password. When visitors open the web page they will see a password box where such a protected content is placed. Upon entering the password, content will be displayed. It's a quick and easy way to protect small parts of your web page content! Try our demo and see how it works! To see the protected content, enter "pass12" in the first password box, and "pass" in the second. Connect and share knowledge within a single location that is structured and easy to search.
I want to make a webpage which has download option for a pdf, but i want it password protected i. Edit: I want user to view the file in browser, not to force it to download here is my code. I don't want code to depend upon pdf plugin used by browser. You can make a. Here's a blog post that I used when I set up my own but essentially your.
You also need to create a. The password needs to be encrypted with MD5 hash but you can use the generator he links to in his blog. Hope this helps. You can still use. How are we doing? Please help us improve Stack Overflow. Which value should i use for access files from the code?
Or protect your directory via. Does the download work with regular permissions? I deny the access to the folder. The script gave me an empty file. Do you use the windows versions? The file is opened in corrupted format. Do you checked the file size for the downloaded file? Tip: Open the file in your text editor, most of the time you can see an error message.
Solve the the reported problem. Otherwise check also your PHP error log. Thanks for the reply. But PDF, image file, txt file will download correctly for same code. I create a seperate controller for only download action. This code includes a form processing script at the beginning of your original code. It first displays a small form to enter your password and if it is ok then shows the original page content.
So now we need to create a PHP script with a simple form processing. The form is very simple, only a password field and a submit button is present. The code is the following:. As we don't want to show the form always we put it inside a function and this function will be called if necessary.
The main application logic checks if the form was submitted or not.
0コメント