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