note 9607 rejected and deleted from popen by jmcastagnetto

From: Date: Tue, 14 Nov 2000 23:05:40 +0000
Subject: note 9607 rejected and deleted from popen by jmcastagnetto
Groups: php.notes 
Request: Send a blank email to php-notes+get-7699@lists.php.net to get a copy of this message
I use following codes to add a user to system, but it doesn't works! My system is terbolinux 6.0.2 + php 4.0.2 + apache 1.3.12. There is an infomation in httpd/error_log file: standard in must in a tty. Who can do me a fever how to solve it? <? /* add a system user by PHP in following code, add a user named james, passwd of root is verygood */ $sucommand = "su --login root --command"; $useradd = "useradd "; $rootpasswd = "verygood"; $user = "james"; $user_add = sprintf("%s "%s %s"",$sucommand,$useradd,$user); $fp = @popen($user_add,"w"); @fputs($fp,$rootpasswd); @pclose($fp); ?> But when I was under console, I type su -l root -c "useradd james" and after I input root's passwd, new user was born...

« previous php.notes (#7699) next »