password protect folders script
Moderator: General Moderators
password protect folders script
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
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.
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
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
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?