hi guys,
i seem to have a problem here. you see i need to execute a php script to execute a shell script which contains the useradd function. however hard i've tried the shell script would'nt work. Btw i'm working on a mandrake machine. heres the script pls help!
php script
<?php
$output = shell_exec("heavenAdd $username $password") ;
echo "<pre>$output</pre>";
echo "testing"
?>
shell script
if [ "$(whoami)" != "root" ] ; then
echo "Error: You must be root to run this command." >&2
exit 1
fi
if [ "$1" = "" ] ; then
echo "You must key in your username as first argument and password as second argument"
exit 1
elif [ "$2" = "" ] ; then
echo "you must key in your password as second argument"
exit 1
fi
adduser $1
echo $2 > passwdfile
passwd --stdin $1 < passwdfile
rm -rf passwdfile