Williamsba, go prowling sites like http://www.hotscripts.com and maybe get a look at some scripts; read through them a bit. There are quite a few around for password protection, both Perl and PHP.
My personal preference is usually Perl; but mostly because I'm slightly more fluent in it than in PHP and, at least for now, there tend to be more scripts available for Perl. PHP is just as good for this, of course!
I'm presuming you have access to the cgi bin on your server?