1. Double check $_GET['username'] to make sure you are not hacked.
PHP Code:
if( isset( $_GET['username'] ) &&
strlen( trim( $_GET['username'] ) ) > 0 ){
$user = trim( $_GET['username'] ) ;
} else {
## handle blank username
}
if( ! ctype_alnum ( $user ) ){
## do something if $user is not alphanumeric
}
2. Create dir if does not exist
PHP Code:
$the_path = '/home/cpanelusername/some/more/path/' ;
$user_dir = $the_path . $user . '/private' ;
if( ! is_dir ( $user_dir ) ){
# try to make the directory
if( ! mkdir( $user_dir , 0755 ) ){
### handle fact that directory not made...
}
}