Home >Backend Development >PHP Tutorial >How to remove web viruses_PHP tutorial

How to remove web viruses_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:07:276413browse

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630433.htmlTechArticleNowadays, the crazy web virus codes often make your website suffer from web virus codes. Our company's server also I encountered the same problem. In my irritation this morning, I wrote a method to remove web viruses...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn