How to clear webpage viruses

Source: Internet
Author: User

Nowadays, the crazy webpage virus code often causes your website to suffer from webpage virus code, and my company server also encounters the same problem, in the morning, I wrote a php program to clear web page viruses. The principle is that this program will be called every time I access it, check whether the reading of an index file is toxic. If so, replace the execution program with the virus. It's just a temporary solution. I hope you can come up with a more advanced solution.

<? Php
Class clear_virus {
Public $ index using 'B .html ';
Public $ filepath javasarray(' B .html ');
Public $ virus_type = "<script src = http: // % 61% 76% 65% 33% 2E % 63% 6E> </script> ";

Function open_file (){
If (file_exists ($ this-> index )){
$ Tmp = file_get_contents ($ this-> index );
If (strrpos ($ tmp, $ this-> virus_type )! = False ){
$ Temp = str_replace ($ this-> virus_type, '', $ tmp );
$ Handle = fopen ($ this-> index, 'w ');
Fwrite ($ handle, $ temp );
Fclose ($ handle );
} Else {
Echo $ this-> virus_find;
}
}
}

}
 
$ Virus = new clear_virus;
$ Virus-> open_file ();
?>
For original site reprinted, please note: www.111cn.cn/phper/php.html

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.