Loading...
 

TogggDeletorPhp

VERY DANGEROUS SCRIPT TO REMOVE FILES AND FOLDERS
evilDon't let this script in your public areaevil

It's only for tiky installers not root not in apache group Tiki02777People confused
It's a very rough script, will clean only what server access.
So you need eventually to help yourself from other way FTP or shell.
A few tries side after side and you will clean everything reachable.

<?php
function delfil($fil) {
    if (!is_dir($fil)) {
        return unlink($fil);
    }
    $dh=opendir($fil);
    while ($subfil=readdir($dh)) {
        if ($subfil!="." && $subfil!="..") {
            $fullpath=$fil."/".$subfil;
            if (!delfil($fullpath)) {
                die("error by {$fullpath}");
            }
        }
    }
    closedir($dh);
    if(rmdir($fil)) {
        return true;
    } else {
        die("cannot remove dir {$fil}");
        return false;
    }
}
function out($txt, $nl = FALSE) {
    static $len = 0;
    $tl = strlen($txt);
    $ret = '';
    if ($nl or ($len + $tl > 80)) {
        $ret = "<br>\n";
        $len = 0;
    }
    $len += $tl;
    return $ret.htmlentities($txt);
}
function lisfil($fil) {
    if (!is_dir($fil)) {
        return out(basename($fil).' ');
    }
    $ret = out($fil, TRUE) . out('', TRUE);
    $dh=opendir($fil);
    while ($subfil=readdir($dh)) {
        if ($subfil!="." && $subfil!="..") {
            $fullpath=$fil."/".$subfil;
            $ret .= lisfil($fullpath);
        }
    }
    closedir($dh);
return $ret;
}
if (isset($_POST['fil'])) {
    $fil = $_POST['fil'];
} else {
    $fil = '';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Toggg's Deletor</title>
</head>
<body>
<FORM method="POST" name="deletor">
<INPUT type="text" name="fil" value="<?php echo $fil; ?>" >
<INPUT type="submit" name="list" value='list'>
<?php
if (!isset($_POST['fil'])) {
    exit('</FORM></body>');
}
$out = lisfil($fil);
$md5 = md5($out);
echo '<INPUT type="hidden" name="md5" value="'.$md5.'">';
if ($_POST['md5'] == $md5) {
    if (isset($_POST['clean']) && $_POST['clean']) {
        delfil($fil);
        $out = lisfil($fil);
    } else {
        echo '<INPUT type="submit" name="clean" value="delete">';
    }
}
echo '</FORM>'.$out;
?>
</BODY>

Page last modified on Thursday 10 February 2005 22:35:55 GMT-0000