900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > php网页病毒清除类【PHP】

php网页病毒清除类【PHP】

时间:2022-06-05 14:04:46

相关推荐

php网页病毒清除类【PHP】

后端开发|php教程

php,网页,病毒,清除,类

后端开发-php教程

本文实例讲述了php网页病毒清除类。分享给大家供大家参考。具体如下:

打开网站说源码库更新,vscode html头部,ubuntu教程pdf下载,Tomcat进程假死,sqlite怎样设置密码,移动端轮播图插件,可拖拽的前端框架,爬虫拆解包,php数据库读取,seo 博客推广,php 威客任务网站源码,网页右下角弹框,php网页模板整站门户,美团外卖页面html代码,vc学生管理系统,arp欺骗程序代码lzw

相信很多人的网页经常被无故的在php,asp,html,js 等文件后台加上一些木马地址,造成了很大的困扰!我以前有个站就是这样,所以一恨之下写了这段代码,文章虽然有一点浪费资源了,但是总比我们手动清除要好吧,下面我为讲讲程序的清除病毒的原理吧.

项目管理系统源码,vscode 写 ext,ubuntu广告显示屏系统,tomcat 配置js,sqlite3-open,jquery 富文本编辑器插件,货拉拉什么前端框架,反爬虫机制 promo,java php c,seo新手入门必备seo顾问,手机网站博客模板,如何修改英文网页模板,仓库单据模板,网站打开很慢跟源码程序lzw

首先们要读取 $checkFile 文件这个文章是判断一个文章 是否被感染了,如果是就会执行$savafile变量里面的txt文件路径的所有文件,进行按你infecFile病毒列表清除一次.

航空订票网站源码,ubuntu查看命令用法,网络爬虫介绍视频,php student,武汉顶级seolzw

<?php

Class clear_virus{

//public $content;

public $infectFile =virus.txt;//病毒文件列表文件

public $savefile ="save.txt";//所在查看病毒的文件列表

public $timep = ime.txt;//些记录清除病毒时间

public $checkFile =e.php;//这里是设置

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").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{

$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();

?>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。