Zubrag.com :: Forum

Programmers Lounge => PHP / MySql / Smarty Questions => Topic started by: conover on April 13, 2015, 11:51:45 PM



Title: password_protect.php: how to have multiple password protected pages
Post by: conover on April 13, 2015, 11:51:45 PM
I am using password_protect.php to password protect some pages on my site.  I want to have different passwords for each page. The first page works fine, but the second one does not. The php files are located in different folders. Any idea what I might be doing wrong?
Thanks.


Title: Re: password_protect.php: how to have multiple password protected pages
Post by: zubrag on April 17, 2015, 02:43:04 AM
password_protect serves to restrict access to multiple pages, similar to how you use one user/password to login to your operating system and see everything that is there.

To have separate password for each page - you can create separate copy of password_protect.php for each page you want to protect, and use specific password there.

Example:
password_protect1.php will have user1/password1 and you add path to this file in your webpage1
password_protect2.php will have user2/password2 and you add path to this file in your webpage2
...

this way each page will be protected with its own set of passwords


Title: Re: password_protect.php: how to have multiple password protected pages
Post by: nathanhollis on August 22, 2016, 10:56:18 AM
password_protect serves to restrict access to multiple pages, similar to how you use one user/password to login to your operating system and see everything that is there.

To have separate password for each page - you can create separate copy of password_protect.php for each page you want to protect, and use specific password there.

Example:
password_protect1.php will have user1/password1 and you add path to this file in your webpage1
password_protect2.php will have user2/password2 and you add path to this file in your webpage2
...

this way each page will be protected with its own set of passwords

You are right. what you are doing sounds okay to me. I would also clear cache if it still doesn't work. My most of the problems solves when I refresh and restart browsers. Minor thing but solves problem most of the time.