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使用ajax的post方式下载excel文件简单示例

本文实例讲述了PHP使用ajax的post方式下载excel文件。分享给大家供大家参考,具体如下: 项目需求,前端发起ajax请求,后端生成excel并下载,同时需要在header头中,...

详解PHP实现定时任务的五种方法

定时运行任务对于一个网站来说,是一个比较重要的任务,比如定时发布文档,定时清理垃圾信息等,现在的网站大多数都是采用PHP动态语言开发的,而对于PHP的实现决定了它没有Java和.Net这...

php自定义函数之递归删除文件及目录

复制代码 代码如下: /*—————————————————— */ //– 递归删除文件及目录 //– 例: del_dir (‘../cache/');注意:返回的/是必须的 //–...

php简单浏览目录内容的实现代码

如下所示:复制代码 代码如下:<?php$dir = dirname(__FILE__);$open_dir = opendir($dir);echo "<table bor...

php使用cookie保存登录用户名的方法

本文实例讲述了php使用cookie保存登录用户名的方法。分享给大家供大家参考。具体如下: 提交表单页面 复制代码 代码如下:<?php $user = isset($_C...