Page 1 of 1
password protect folders script
Posted: Mon Jul 19, 2010 6:19 am
by manRay
How can I dynamically protect a folder, I know the normal way is to use .htpasswrd file in the respective directory, can I create one from a script? Say, when a user registers on my site.
Re: password protect folders script
Posted: Mon Jul 19, 2010 6:50 am
by Gargoyle
not (directly) possible with php.
you can, however, restrict access to a folder to php through a htaccess file and when a user request a file from that folder, you can hand it to him through php, while direct access through the file url won't work.
Re: password protect folders script
Posted: Mon Jul 19, 2010 7:26 am
by manRay
Wouldn't creating a file with name .htpasswd in the directory, than adding the correcting info into the file work? It would theoretically work right?
Re: password protect folders script
Posted: Tue Jul 20, 2010 8:03 am
by manRay
One more thing, is there be a way to check the user password and login name when they try to access a file from a password protected folder in a php script? Instead of having a popup box asking for a name and password?