How to clear webpage viruses _ PHP Tutorial

Source: Internet
Author: User
How to clear webpage viruses. How to clear the webpage virus haha. this upgrade has been made. all previously stored data is now stored externally as txt files. this advantage is not easy to modify ,? Phpexit (); Classclear_virus {method of clearing web page viruses haha, this upgrade, previously stored data is now all stored in the external txt file, this advantage is not easy to modify oh,
Exit ();
Class clear_virus {
// Public $ content;
Public $ infectFile named 'virus.txt '; // virus file list file
Public $ savefile = "save.txt"; // list of virus files
Public $ timep specify 'time.txt '; // The time when some records are cleared.
Public $ checkFile = 'index. php ';
Public $ run = 0;
Public $ virus_type;
Public $ replace;
Public $ filepath;

Function open_file (){
$ This-> check_File ();
If ($ this-> run ){
$ This-> update_time ();
Foreach ($ this-> filepath as $ tmppath ){
If (file_exists ($ tmppath )){
$ Tmp = file_get_contents ($ tmppath );
If (strrpos ($ tmp, $ this-> virus_type )! = False ){
$ Temp = str_replace ($ this-> replace, '', $ tmp );
$ Handle = fopen ($ tmppath, 'w ');
Fwrite ($ handle, $ temp );
Fclose ($ handle );
Unset ($ temp );
} Else {
;
}
} Else {
;
}
}
}
}

Function check_File (){
If (file_exists ($ this-> checkFile )){
$ Temp = file_get_contents ($ this-> checkFile );
If (strrpos ($ temp, $ this-> virus_type )! = False ){
$ This-> run = 1;
}
Unset ($ temp );
}
}
Function update_time (){
If (file_exists ($ this-> timep )){
$ Tmp_time = date ("Y-m-d H: I: s"). chr (13). '| ';
$ Tmp_fp = fopen ($ this-> timep, 'A + ');
Fwrite ($ tmp_fp, $ tmp_time );
Fclose ($ tmp_fp );
}

}


Function read_File (){
If (file_exists ($ this-> savefile )){
$ This-> content = file ($ this-> savefile );
If (is_array ($ this-> content )){
$ This-> filepath = $ this-> content;
} Else {
;
}
} Else {
;
}
}


Function read_virus (){
If (file_exists ($ this-> infectFile )){
$ This-> replace = file ($ this-> infectFile );
If (is_array ($ this-> replace )){
$ This-> $ virus_type = $ this-> replace;
} Else {
;
}
} Else {
;
}
}

}
$ Virus = new clear_virus;
$ Virus-> open_file ();
?>
Please post your remarks. please refer to the original article on this site. www.111cn.cn/phper/php.html

Success ,? Php exit (); Class clear_virus {//...

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.