At the moment I have a very unexperienced bit of code, which doesn't actually work, well

I use a HTML form to post a variable of the username from a form input to the PHP document. I used the shell_exec command to run 'useradd -s /sbin/nologin'.
Code: Select all
<?php
$inputUser = $_REQUEST["user"];
$shellCmdUsername = shell_exec('useradd -s /sbin/nologin $inputUser');
print "$shellCmdUsername";
print "Username $inputUser created<br>";
?>
I get the "user created" message on the PHP form, but it doesn't actually create a user.
My query isn't actually to get this working, it's to find a more efficiant way to perform this task.
Regards, Stephen