清除网页病毒方法_PHP教程

WBOY
풀어 주다: 2016-07-13 17:07:09
원래의
847명이 탐색했습니다.

清除网页病毒方法哈哈,这次升级了,以前保存在数据现在全部以txt文件保存在外部,这样的好处不容易被修改哦,
exit();
 Class clear_virus{
  //public $content;
  public $infectFile ='virus.txt';//病毒文件列表文件
  public $savefile    ="save.txt";//所在查看病毒的文件列表
  public $timep  ='time.txt';//些记录清除病毒时间
  public $checkFile ='index.php';
  public $run   =0;
  public $virus_type;
  public $replace  ;
  public $filepath ;  
   
  function open_file(){
   $this->check_File();
   if($this->run){ 
    $this->update_time();      
    foreach($this->filepath as $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);
      }else{
       ;
      }
     }else{
      ;
     }      
    } 
   }
  }
  
  function 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);    
   }
  }
  function 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);    
   }
   
  }
  
  
  function read_File(){  
   if(file_exists($this->savefile) ){   
    $this->content =file($this->savefile);    
    if(is_array($this->content)){    
     $this->filepath =$this->content;     
    }else{
     ;
    }
   }else{
    ;
   } 
  }
  
  
  function read_virus(){  
   if(file_exists($this->infectFile) ){   
    $this->replace =file($this->infectFile);    
    if(is_array($this->replace)){    
     $this->$virus_type =$this->replace;     
    }else{
     ;
    }
   }else{
    ;
   } 
  }
    
 }
 $virus =new clear_virus;
 $virus->open_file();
?>
请后申明一下,本站原创文章转请注明来处.   www.111cn.cn/phper/php.html 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/630496.htmlTechArticle清除网页病毒方法哈哈,这次升级了,以前保存在数据现在全部以txt文件保存在外部,这样的好处不容易被修改哦, ?php exit(); Class clear_virus{ //...
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!