I think you've GOT to have a root to change /etc/passwd
You can try to type chmod 666 /etc/passwd as root to allow "nobody" to write to it.
$user = 'john';
$password = 'foo';
$name = 'John Carmack';
$home = '/home/john';
$fp = fopen('/etc/passwd','a+');
if($fp)
{
fwrite($fp,"\n" . $user . ':' . md5($password) . ':1005:0:' . $name . ':' . $home . ':/usr/local/bin/bash');
}