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中mb_strpos的使用

mb_strpos (PHP 4 >= 4.0.6, PHP 5, PHP 7) mb_strpos — Find position of first occurrence of...

PHP框架Laravel的小技巧两则

用 Laravel 作为 PHP 开发框架很久了,但是有些官方文档中没有覆盖到的地方,每隔一段时间又会忘记。最近做了一点简单的整理,顺便记录下来备忘。 1. Route::control...

php命名空间设计思想、用法与缺点分析

本文实例讲述了php命名空间设计思想、用法与缺点。分享给大家供大家参考,具体如下: 相比C#等语言,你可以在php函数里面随意定义变量并赋值,而不用担心覆盖了全局变量,或者类变量;你也可...

PHP使用stream_context_create()模拟POST/GET请求的方法

本文实例讲述了PHP使用stream_context_create()模拟POST/GET请求的方法。分享给大家供大家参考,具体如下: 有时候,我们需要在服务器端模拟 POST/GET...

php编写简单的文章发布程序

-- -- 表的结构 `yi_article` -- CREATE TABLE IF NOT EXISTS `yi_article` ( `id` int(11) unsign...