PHP - add rm %dir to php code

Hello everyone,

I'm trying to modify a php file to perform 2 actions in an if statement.

// If the delete button is pressed
                if(isset($_GET['delete']) && isset($_GET['username_box']))
                {
                        if(!mysql_query("DELETE FROM users WHERE User='".$_GET['username_box']."'",$link))
                        {
                                echo ("<br>Error: Not a valid DELETE query.<br>");
                                echo ("<br>MySql error : ".mysql_error());
                        }else
                        {
                                $table_users  = "SELECT * FROM users ORDER BY User ASC";
                                $query_users  = mysql_query($table_users);
                                $length_users = mysql_numrows($query_users);

                                send_delete_notification($_GET['username_box']);

                        }
                        // same effect when the 'new user' button is pressed
                        $new=1;
                }

The code is taken from Machiel's FreeBSD page (Dutch & English), and the file is the index.php. That piece of code is executed when the "Remove" button is pressed in the web interface. What I need to do is add some php code to also remove the corresponding home directory of the user. I tried with the "exec" function in php but failed miserably. The user home dirs are located under "/home/ftpusers/<ftp_login_account>".

I would appreciate a few pointers here or a piece of code maybe.

Thanks!

Look system cmd, but http-server has not usually enough privileges to do ex. rm some user directory.

Need sudo or some other method to get enough privileges.

Make use of ftp_rmdir

For more details : PHP: ftp_rmdir - Manual