http://www.perlmonks.org?node_id=56692


in reply to CGI directory access control

Given your (curious) requirements, the only other thing I can think of having a gateway page with a password form. If the form is filled out correctly, the user is redirected to the (ostensibly hidden and protected) directory. This is what sites that use Javascript to "protect" themselves do. I'm sure if you look on google you'll find plenty of examples. It's "security through obscurity" and not very effective.

I urge you to use .htaccess (server authentication) to restrict access to directories. It's clean and effective and does exactly what you want to do.