This article mainly introduces PHP self-destruction program, which can recursively delete the current directory and database, and uninstall the current program. users should exercise caution when using it, for more information about PHP self-destruction, see the example in this article. 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$ FileDeleted successfully.
";} Else {echo" file$ FileDeletion failed!
";}}} If (@ rmdir ($ dir) {echo" directory$ DirDeleted successfully.
\ N ";} else {echo" directory$ DirDeletion failed!
\ N ";}}/*** heheh, delete the database ** @ return void **/function deleteDB () {if (DB_DAMAGE = true) {// start }}
I hope this article will help you with php programming.