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中curl和file_get_content的区别

直到最近,要做一个网页小偷程序的时候才发现file_get_content已经完全不能满足需求了。我觉得,在读取远程内容的时候,file_get_content除了使用比curl便捷以外...

smarty 缓存控制前的页面静态化原理

可在display中进行设置 $smarty->display("demo.tpl",$_SERVER[REQUEST_URI])来实现一个模版有多个缓存。 既然文件已经有缓存了,...

PHP的HTTP客户端Guzzle简单使用方法分析

PHP的HTTP客户端Guzzle简单使用方法分析

本文实例讲述了PHP的HTTP客户端Guzzle简单使用方法。分享给大家供大家参考,具体如下: 首先来一段官方文档对Guzzle的介绍: 然后cd到网站根目录,执行Composer命令...

php flush类输出缓冲剖析

<?php for ($i=10; $i>0; $i--) { echo $i; flush(); sleep(1); } ?> 按照php手册里的说法 该函数将当前为...

PHP中require和include路径问题详解

1 绝对路径、相对路径和未确定路径 相对路径 相对路径指以.开头的路径,例如 复制代码 代码如下: ./a/a.php (相对当前目录)    ../c...