A reader asks:
How do you think that i could make a login page with a password using CGI script?
There are two main ways to create a password-protected Web area…
One solution is using hooks in the web server (usually Apache) and the other is, well, with the common gateway interface…
For an Apache-based solution, your avenue is the .htaccess file that you drop into a directory you want to password protect. Most web hosting providers have instructions on how to set this up and create accounts for people to access the subdirectory. it’s the preferred solution, and how I do it when I need to protect an area of a site. here’s a geeky sort of page with more information on this.
If you want to do this with CGI, I’d approach it by having a small HTML page that prompts for a login and password pair, then feeds that to a CGI script that chops the QUERY_STRING into two parts, then simply compares them to a known set of account fields. If there’s a match, the program outputs a specified source file (perhaps “logged-in.html”), and if the match fails, the program outputs an error message.
This should be quite easy to whip together in Perl or even as a Unix shell script.