That really depends on several things.
Do you want the web server to authenticate it? If so, what web server are you running?
Apache:
http://www.freewebmasterhelp.com/tutorials/htaccess/3
IIS: I don't remember how (been too long since I've used MS web servers)
If you don't want the web server to do it, then we'll need to know what lanugage you plan on using. Additionally, how do you want to store the usernames and passwords? If it's a database, we'll need to know what type you want. If it's a text file you intend to use, that's a little different script.
Brian.