Entry
Can I use PHP to add a new user and password to my Unix system?
How can I add a new user to my FreeBSD system using PHP?
Jul 19th, 2004 23:24
Alder Rus, Edwin Chan, Nathan Wallace, http://www.directoryonclick.com , http://www.singapore-yellow-pages.com
Try exec'ing 'adduser' from PHP. For more information on adduser do
this at the unix command line:
man adduser
For security's sake make sure you do some sensible checking /
protection for the parameters.
For example,
<?php
$passwdexe="/usr/local/bin/adduser";
$user="myname";
$group="users"
$passwd="mypassword";
$add_passwd.="$passwdexe -g $group -p $passwd $user";
$result = system("$add_passwd");
?>