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 PDOStatement:bindParam插入数据错误问题分析

废话不多说, 直接看代码:复制代码 代码如下:<?php$dbh = new PDO('mysql:host=localhost;dbname=test', "test");$qu...

php从数组中随机抽取一些元素的代码

复制代码 代码如下: <?php class getValues { public function inputValue($inputArray) { $this->inp...

php HtmlReplace输入过滤安全函数

复制代码 代码如下: // $rptype = 0 表示仅替换 html标记 // $rptype = 1 表示替换 html标记同时去除连续空白字符 // $rptype = 2 表示...

zend framework配置操作数据库实例分析

zend framework配置操作数据库实例分析

zendframework项目环境搭建后,看了下zend framework配置操作数据库,php教程如下: 在application/configs的文件下建立一个config.ini...

PHP反射实际应用示例

本文实例讲述了PHP反射实际应用。分享给大家供大家参考,具体如下: 1.自动生成文档 根据反射的分析类,接口,函数和方法的内部结构,方法和函数的参数,以及类的属性和方法,可以自动生成文档...