Loading...
 
Skip to main content

History: TogggDeletorPhp

Preview of version: 2

VERY DANGEROUS SCRIPT TO REMOVE FILES AND FOLDERS
Don't let this script in your public area
Copy to clipboard
<?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>

History

Advanced
Information Version
bertrand Gugger 5
View
bertrand Gugger Made better intro 4
View
bertrand Gugger 3
View
bertrand Gugger Wrapped out a long code line for doctype 2
View
bertrand Gugger 1
View