Passwords are stored
encrypted in /etc/shadow. But the "useradd -p 1234" program puts "1234"
unencrypted in /etc/shadow. (check it with "grep monzter /etc/shadow" (as root))
So, when you log in, the "login" program encrypts "1234", and compares the result to the
unencrypted "1234" in /etc/shadow. This fails (of course).
The man page for "useradd" mentions that the "-p" option needs an already encrypted password as returned by the crypt() function.
PHP has the crypt() function also, so try that. But you may need to process the returned string some more, using the pack() and/or base64_encode() functions, I'm not sure.
Also keep in mind that your Linux-system maybe setup to use password encrypted with the MD5 algorythm (many do that nowadays) instead of crypt(). MD5 is also available in PHP.
Here's a page that talks about encrypting passwords for LDAP with PHP. This may (partly) apply to /etc/shadow.
http://www.openldap.org/faq/data/cache/347.html