For one thing, why are you setting the initial directory to 0755, then chmodding it to 0777, why not just set it to 0777 to begin with? And to that... why not just define one path, make it recursive, and chmod it...
$path = 'members/' . $fl . '/' . $name . '/priv/';
mkdir($path, 0777, true);
The recursive item was added in php 5, but you should probably be running some form of php5 since php4 is at the end of its life.
Alternatively, in the [man]mkdir/man usrenotes, there's a function to do exactly what you want:
function recursive_mkdir( $folder )
{
$folder = explode( DIRECTORY_SEPARATOR , $folder );
$mkfolder = '';
for( $i=0 ; isset( $folder[$i] ) ; $i++ )
{
$mkfolder .= $folder[$i];
if( !is_dir( $mkfolder ) )
mkdir( "$mkfolder" , 0777);
$mkfolder .= DIRECTORY_SEPARATOR;
}
}