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();
?>
-
PHP緩存技術
PHP具有非常強大的功能,所有的CGI的功能PHP都能實現,而且支持幾乎所有流行的數據庫以及操作系統。最重要的是PHP可以用C、C++進行程序的擴展!以下是小編為大家搜索整理的PHP緩存技術,希望能給大家帶來幫助!更多精彩內容請及時關注我們應屆畢業生考試網!全頁面靜態...
-
PHP中超全局變量$GLOBALS和global的區別
人之所以能,是相信能。努力總是會有收穫的。下面是小編整理的PHP中超全局變量$GLOBALS和global的區別,希望對大家有用,更多消息請關注應屆畢業生網。一、超全局變量$GLOBALSPHP超全局變量有很多,如下的都屬於超全局變量(Superglobal):$GLOBALS,$_SERVER,$_GET,$_POST,$_...
-
PHP的漏洞-如何防止PHP漏洞
漏洞無非這麼幾類,XSS、sql注入、命令執行、上傳漏洞、本地包含、遠程包含、權限繞過、信息泄露、cookie偽造、CSRF(跨站請求)等。下面是小編為大家帶來的關於PHP的漏洞的知識,歡迎閲讀。+sql注入其中佔大頭的自然是XSS與SQL注入,對於框架類型或者有公共文件的,建...
-
PHP中用CURL偽造IP來源的方法
PHP中用CURL偽造IP來源的.方法,有需要的朋友可以看看。就跟隨本站小編一起去了解下吧,想了解更多相關信息請持續關注我們應屆畢業生考試網!1.文件複製代碼代碼如下:<?php$ch=curl_init();curl_setopt($ch,CURLOPT_URL,"http://localhost/");curl_setopt($ch,CURL...