Its really tough to answer your question w/o more information. Assuming you are in a CGI/mod_perl/apache
environment, I would highly recommend Lincoln Stein's book
which discusses all the nifty things you can do in
during the authorization/authenticaion phases. This includes connecting to a backend database and granting access based on a login and password combo.