php網頁病毒清除的方法
很多人的網頁經常被無故的在php,asp,html,js 等文件後台加上一些木馬地址,造成了很大的困擾,你知道要怎麼清除php網頁病毒嗎?下面是應屆畢業生小編整理的一些關於php網頁病毒清除的'方法的相關資料,供你參考。
php網頁病毒清除的方法:
首先們要讀取 $checkFile 文件這個文章是判斷一個文章 是否被感染了,如果是就會執行$savafile變量裏面的txt文件路徑的所有文件,進行按你infecFile病毒列表清除一次.
複製代碼 代碼如下:
Class clear_virus{
//public $content;
public $infectFile ='';//病毒文件列表文件
public $savefile ="";//所在查看病毒的文件列表
public $timep ='';//些記錄清除病毒時間
public $checkFile ='';//這裏是設置
public $run =0;
public $virus_type;
public $replace ;
public $filepath ;
public $tag =0;
function open_file(){
$this->read_virus();
$this->check_File();
if($this->run){
$this->update_time();
$this->read_file() ;
foreach($this->filepath as $tmppath){
if(file_exists($tmppath)){
$tmp_file =file_get_contents($tmppath);
print_r( $this->virus_type);
for( $i=0;$ivirus_type);$i++ ){
if( strrpos($tmp_file,$this->virus_type[$i])!== false){
$tmp_file =str_replace($this->virus_type[$i],'',$tmp_file);
$this->tag =1;
}
}
if( $this->tag ){
$handle =fopen($tmppath,'w');
fwrite($handle,$tmp_file);
fclose($handle);
unset($tmp_file);
}
}else{
;
}
}
}
}
function check_File(){
if(file_exists($this->checkFile) ){
$temp =file_get_contents($this->checkFile) ;
echo $temp;
foreach( $this->virus_type as $v_tmp ){
if( strrpos($temp,$v_tmp)!== false ){
$this->run =1;
break;
}
}
echo $this->run;
unset($temp);
}else{
$this->show_error(5);
}
}
function update_time(){
if(file_exists($this->timep) ){
$tmp_time =date("Y-m-d H:i:s")(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{
$this->show_error(3);
}
}else{
$this->show_error(4);
}
}
function read_virus(){
if(file_exists($this->infectFile) ){
$this->replace =file($this->infectFile);
if(is_array($this->replace)){
$this->virus_type=$this->replace;
}else{
$this->show_error(1);
}
}else{
$this->show_error(2);
}
}
function show_error($number){
$array = array(
'1'=>'病毒文件未不能讀取!',
'2'=>'病毒文件列表不存在!',
'3'=>'文件列表不存了',
'4'=>'查殺的文件不存',
'5'=>$this->$checkFile.'不存在了,請設置病毒感染文件'
);
echo $array[$number];
}
}
$virus =new clear_virus;
$virus->open_file();
?>
-
如何理解Javascript的caller,callee,call,apply區別
在提到上述的概念之前,首先想説説javascript中函數的隱含參數:argumentsarguments該對象代表正在執行的函數和調用它的函數的參數。[function.]arguments[n]參數function:選項。當前正在執行的Function對象的名字。n:選項。要傳遞給Function對象的從0開始的參數值...
-
PHP開發工程師的具體職責
PHP開發工程師的具體職責1職責:1,負責設計產品的前後台技術框架;2,承擔系統的開發工作,改進框架,基礎架構,持續優化服務;3,承擔關鍵項目的技術評審及總體設計,參與構建系統原型及關鍵技術問題的攻關活動;4,控制產品設計質量,制定產品開發規範、指導或撰寫方案、設計等文檔;5,...
-
JavaScript 函數表達式
JavaScript中創建函數主要有兩種方法:函數聲明和函數表達式。這兩種方式都有不同的適用場景。這篇筆記主要關注的是函數表達式的幾大特點以及它的使用場景,下面一一描述。主要特點可選的函數名稱函數名稱是函數聲明的必需組成部分,這個函數名稱相當於一個變量,新定...
-
學習JavaScript的7個理由
為什麼要學習JavaScript?學習JavaScript對我們的工作有什麼幫助麼?下面YJBYS小編為大家講解!需求我之所以這樣説的主要原因是,隨着JavaScript的日漸成熟,以及方案變得越來越可行,我們對JavaScript程序員的需求正在持續增長。JavaScript在需求比例上已經超過了C#,僅...