Re: New User Creation.

From: Date: Fri, 18 Jul 2003 09:23:23 +0000
Subject: Re: New User Creation.
References: 1  Groups: php.install 
Request: Send a blank email to php-install+get-11305@lists.php.net to get a copy of this message
I suppose that your web server is running with non-privileged user. In this case you have to use sudo (man sudo). Also you have to make some checks like if (ereg("[|;,:'\\\"]", $_POST[PASSWORD]) || ereg("[|;,:'\\\"]", $_POST{USERNAME])) { die "<B>Invalid username or password.<br>"; } Remember that it's very important to check for "|" and ";" in the username/password otherwise some nasty user could inject code after the useradd command. Stratsimir Rajendra Kumar wrote:
hello Mr. Thomas, thanks for the quick reply. i implimented your code. let me know what's wrong with my code. newuser.htm: html head body form action = "signup.php" method = post Username: input type = text size = 30 name = "USERNAME" Password: input type = password size = 30 name = "PASSWORD" Confirm: input type = password size = 30 name = "VERIFYPASSWORD" input type = submit value = "Sign Up" /form /body /html signup.php <?php IF ($_POST[PASSWORD] == $_POST[VERIFYPASSWORD]){ exec("/usr/sbin/useradd -p $_POST[PASSWORD] $_POST[USERNAME]"); } else { Print("<b> Passwords did not match"); } ?> can u suggest me.?


« previous php.install (#11305) next »