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的Yii框架的运行机制及其路由功能

详解PHP的Yii框架的运行机制及其路由功能

运行机制概述 每一次 Yii 应用开始处理 HTTP 请求时,它都会进行一个近似的流程。 用户提交指向 入口脚本 web/index.php 的请求。 入口脚本会加载 配置数组...

在PHP中实现Javascript的escape()函数代码

这里,一般都需要预先将正常的字符串编码成 JavaScript unescape() 函数能够解译的格式,以 PHP 为例,可以使用以下函数实现 Javascript 中 escape(...

php数组操作之键名比较与差集、交集赋值的方法

本文实例讲述了php数组操作之键名比较与差集、交集赋值的方法。分享给大家供大家参考。具体方法如下: 该实例主要实现对数组的各种常见操作。如对键名比较计算数组的差集,计算差集,给指定数组中...

PHP中is_file不能替代file_exists的理由

我们可以使用下面的代码测试一下:复制代码 代码如下:<?php        $filename = 'test.txt...

一些常用的php简单命令代码集锦

删建:  引用 if(file_exists("file.htm"))// 检查是否存在此文件 if(file_exists("chat"))//检查是否存在此文件夹...