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信号处理机制的操作代码讲解

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

PHP日志LOG类定义与用法示例

本文实例讲述了PHP日志LOG类定义与用法。分享给大家供大家参考,具体如下: <?php /** * PHP log 类 */ class Config{ pub...

php+xml编程之SimpleXML的应用实例

本文实例讲述了php+xml编程之SimpleXML的应用。分享给大家供大家参考。具体如下: SimpleXML的核心思想:以面向对象的方式来操作xml文件,它会将xml文件的所有元素都...

php中iconv函数使用方法

iconv函数库能够完成各种字符集间的转换,是php编程中不可缺少的基础函数库。 1、下载libiconv函数库http://ftp.gnu.org/pub/gnu/libiconv/l...

php关键字仅替换一次的实现函数

对于批量替换关键字的问题,仅替换而言没什么可说的,但这里需要的是每个关键字仅需要替换一次就可以了。查阅了php相关函数文档,发现php本身是没有函数实现这个功能的,所以不得不自己解决了。...