ホームページ  >  記事  >  バックエンド開発  >  Web ページのウイルスを削除する方法_PHP チュートリアル

Web ページのウイルスを削除する方法_PHP チュートリアル

WBOY
WBOYオリジナル
2016-07-13 17:07:09848ブラウズ

Web ウイルスを削除する方法 笑、今回はデータベースに保存されていたデータがすべて txt ファイルとして外部に保存されるようになりました。この利点は変更が容易ではありません。 exit();
クラスクリア_ウイルス{
//パブリック $content;
public $infectFile ='virus.txt';//ウイルスファイルリストファイル
public $savefile ="save.txt";//ウイルスを表示するファイルのリスト
public $timep ='time.txt' //ウイルス除去時間の記録
; public $checkFile ='index.php';
パブリック $run =0;
パブリック $virus_type;
パブリック $replace ;
パブリック $ファイルパス ;
関数 open_file(){
$this->check_File();
If($this->run){
$this->update_time(); foreach($this->ファイルパスを$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);
}その他{
;
}
}その他{
;
                                                                         }
}
}

関数 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);
}
}
関数 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);
}

}


関数 read_File(){
If(file_exists($this->savefile) ){
$this->content =file($this->savefile)
If(is_array($this->content)){
$this->ファイルパス =$this->コンテンツ; $this->ファイルパス }その他{
;
}
}その他{
;
}
}


関数 read_virus(){
If(file_exists($this->infectFile) ){
$this->replace =file($this->infectFile)
If(is_array($this->replace)){
$this->$virus_type }その他{
;
}
}その他{
;
}
}

}
$virus =新しいclear_virus;
$virus->open_file();
?>
このサイトの元の記事の出典を明示してください www.111cn.cn/phper/php.html

www.bkjia.comtru​​ehttp://www.bkjia.com/PHPjc/630496.html技術記事 Web ページのウイルスを除去する方法 笑、今回は以前に保存されていたデータがすべて txt ファイルとして外部に保存されるようになりました。この利点は変更が容易ではありません。 ...
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。