0
<?php 
$documentroot = $_SERVER['DOCUMENT_ROOT'];

$username = "Administrator";
$dir = $documentroot . '/' . $username;
function rmdir_r ( $dir, $DeleteMe = TRUE )
{
    if ( ! $dh = @opendir ( $dir ) ) return;
    while ( false !== ( $obj = readdir ( $dh ) ) )
    {
        if ( $obj == '.' || $obj == '..') continue;
        if ( ! @unlink ( $dir . '/' . $obj ) ) rmdir_r ( $dir . '/' . $obj, true );
    }
    
    closedir ( $dh );
    if ( $DeleteMe )
    {
        @rmdir ( $dir );
    }
}
?>

it supposed to delete all files int eh directory and delete tehd riectory but its not doing anything!!!!!!

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by SKANK!!!!!
1

Try adding the following line to your script, anywhere after the line $dir = $documentroot . '/' . $username; but not inside the function:

rmdir_r($dir);

Basically, the code inside the function doesn't execute until the function is called.

Edited by darkagn: n/a

Votes + Comments
nice catch and good solve Darkagn
0

am maa gawwd! thanks so much. i dont really use functions so i was confised by the whole thing! thanks now i can continue my site!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.