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中使用preg_replace函数匹配图片并加上链接的方法

介绍:preg_replace 执行正则表达式的搜索和替换,如果只是单纯的匹配字符串建议使用str_replace(),因为其执行效率高的多。mixed preg_replace ( m...

php数组中删除元素之重新索引的方法

如果要在某个数组中删除一个元素,可以直接用的unset,但今天看到的东西却让我大吃一惊 复制代码 代码如下: <?php $arr = array('a','b','c',...

php数据访问之增删改查操作

php数据访问之增删改查操作

增删改查操作小练习,大家练练手吧 一、查看新闻页面-----主页面 <html> <head> <meta http-equiv="Content...

判断php数组是否为索引数组的实现方法

HP没有内置判断是否索引数组的方法,简单实现了一个,用法:复制代码 代码如下:echo is_assoc($array)?'索引数组':'不是索引数组';is_assoc函数如下:复制代...

Wordpress 相册插件 NextGEN-Gallery 添加目录将中文转为拼音的解决办法

NextGEN Gallery是Wordpress中著名的相册插件,遗憾的是不支持中文等unicode字符,本文将介绍如何将目录转换为拼音(添加图集时)。 以NextGEN 1.6.2为...