First, you can't do this without being root.
Second, you could give root-privileges to the webserver user, but you'd be a fool to do so.
Third, if you use man useradd you will see there is an option to enter the password on the commandline.
If you feel lucky you can create a script that will write the new usernames and passwords to a file.
Carefull, that file will be readable to the webserver, and thus to everybody who can write PHP/CGI scripts on your server.
Then the root's crontab can start a script every 5 minutes that reads that file and creates all the accounts.
Note: be very very carefull, you are opening up your system to a whole new range of dangers.