You can run something like this...
$newuser = "/dir_of_htpasswd/htpasswd -b /securitydirectory/access_file $username $password 2>&1";
system($newuser);
This will dump the output of htpasswd write onto your webpage.
Remember 2>&1 is the redirect sub command for Output from your LINUX box. This is so you can have verification of change.
Make sure you incorporate some type of Encrypted Password check You do not want someone spoofing and overwriting your administrators password!.. Also a good idea is to force MD5, also force a password and verification password script.
Something along the lines of this for NULL usernames as well..
If ((!is_null($username)) && (!$username==""))
{
If ($password==$vpassword)
{
😉 - Shadowbq