I have to agree with Siberian, it sounds as if you've got the cart in front of the horse. You need to do a lot of planning before you start writing a script. As mentioned, what, where, and how will you store passwords/usernames? How will they get there initially - via web page (user entered), manual entry (from email/snailmail/phone call), or will they be automatically assigned by some server-side application?
Answer these questions and you'll be almost ready to think about writing a script. Other considerations will be: what scripting language(s) does my web host support? (PERL, PHP, ASP, C, VB, ???). Who ar my potential users?, How many will there be? How many will be accessing this routine at the same time? Are there resource sharing conflicts I need to consider?
Answer all of these and you can start to outline your scipt.
Good luck!!
There's always a better way. The fun is trying to find it!