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用SAX解析XML的实现代码与问题分析

复制代码 代码如下: <?php $g_books = array(); $g_elem = null; function startElement( $parser, $name...

基于PHP读取csv文件内容的详解

一次性读取csv文件内所有行的数据复制代码 代码如下:<?php $file = fopen('windows_2011_s.csv','r'); while ($data = f...

ThinkPHP实现递归无级分类——代码少

具体代码如下: /** * 无级递归分类 * @param int $assortPid 要查询分类的父级id * @param mixed $tag 上...

PHP信号处理机制的操作代码讲解

我们首先来看下实例代码: function sig_handler($sig) { print("handled sig: $sig\n"); } pc...

PHP简洁函数(PHP简单明了函数语法)

1、与mysql相关 mysql_connect 建立一个与MySQL服务器的连接 语法 resource mysql_connect(string server[,string usi...