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编程获取图片的主色调的方法【基于Imagick扩展】

本文实例讲述了PHP编程获取图片的主色调的方法。分享给大家供大家参考,具体如下: 代码中用到了php的图片扩展,所以使用之前,需要先安装PHP的Imagick扩展,具体安装如下(wind...

一道关于php变量引用的面试题

php面试题题目如下: 复制代码 代码如下: <?php $a = 1; $x =&$a; $b=$a++; ?> 问: $b和$x的值分别是什么? php面试题的答案如下...

洪恩在线成语词典小偷程序php版

主要函数是file_get_contents,主程序分两段,跟我一起看过来吧(凡人博客原创代码,转载请注明)。 复制代码 代码如下: function escape($str){ pre...

PHP巧妙利用位运算实现网站权限管理的方法

首先我们先定义4个常量来设定四种权限: ===================================== define(ADD,1);//增加数据库记录的权限 define(...

PHP的Yii框架中行为的定义与绑定方法讲解

定义行为 要定义行为,通过继承 yii\base\Behavior 或其子类来建立一个类。如: namespace app\components; use yii\base\Beh...