Nowadays, the crazy web virus codes often make your website suffer from web virus codes. Our company's server also encountered the same problem. In the morning, I was irritable and wrote a php program to remove web viruses. The principle is that this kind of program will be called every time it is accessed. If an index file is read to see if it is poisonous, just replace the virus with the execution program and it will be OK. It is just a temporary method. I hope experts can come up with more advanced methods to deal with it.
Class clear_virus{
public $index ='b.html';
public $filepath =array('b.html');
public $virus_type ="";
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();
?>
Please indicate the original reprint on this site: www.111cn.cn/phper/php.html