note 14231 added to function.popen.php
| From: | ipman at sohu dot com | Date: | Mon, 23 Jul 2001 16:18:34 +0000 |
| Subject: | note 14231 added to function.popen.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15709@lists.php.net to get a copy of this message | ||
why i can't add a user by using popen?
<?
$sucommand = "su --command=";
$useradd = "/usr/sbin/useradd ";
$rootpasswd = "mypassword";
$user = "tom";
$user_add = sprintf("%s'%s %s'",$sucommand,$useradd,$user);
$fp = popen($user_add,"w");
fputs($fp,$rootpasswd);
pclose($fp);
?>
http://www.php.net/manual/en/function.popen.php