note 38693 rejected from function.popen by nlopess
| From: | nlopess@php.net | Date: | Sat, 03 Jan 2004 10:07:42 +0000 |
| Subject: | note 38693 rejected from function.popen by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62846@lists.php.net to get a copy of this message | ||
Note Submitter: amarullahthea@yahoo.com
----
<?php
$newuser = 'user1';
$UserPassword='foo12345';
$RootPassword='secret';
//execute the su command (RedHat-LINUX-9)
$fp=popen("su -l -command=
/usr/sbin/adduser $newuser;/usr/sbin/passwd
$newuser","w");
// 1st line --> Input the Root Password (SU command)
// 2nd line --> Input User Password (PASSWD command)
// 3rd line --> Input User Password Again (PASSWD command)
fwrite($fp,"\n$RootPassword\n$UserPassword\n$UserPassword\n");
pclose($fp);
?>
But This script doesn't work to make a new user and password for new user. WHY????????