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

相关文章

dedecms模板标签代码官方参考

没想到dedecms可以这样DIY,牛啊地址:http://www.dedecms.com/archives/templethelp/help/ 在了解DedeCms的模板代码之前,了解...

PHP中Socket连接及读写数据超时问题分析

本文实例讲述了PHP中Socket连接及读写数据超时问题。分享给大家供大家参考,具体如下: 虽然PHP中对fsockopen()方法有连接socket的超时参数,但是没有类似C中的连接成...

php 删除cookie方法详解

我们先来看下相关cookie的机制。 复制代码 代码如下: bool setcookie ( string name [, string value [, int expire [, s...

php中获取远程客户端的真实ip地址的方法

(1).REMOTE_ADDR:浏览当前页面的用户计算机的ip地址 (2).HTTP_X_FORWARDED_FOR: 浏览当前页面的用户计算机的网关 (3).HTTP_CLIENT_I...

php实现指定字符串中查找子字符串的方法

本文实例讲述了php实现指定字符串中查找子字符串的方法。分享给大家供大家参考。具体分析如下: 对strpos()函数可以用来在php中查找子字符串。strpos()函数将试图找到子字符串...