php 清除网页病毒的方法

yipeiwu_com5年前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上传excel表格并获取数据

这个是最近需要做的一个功能,在网上也查看了很多相关的文章,基本上大同小异,在这里整理一下。 一:首先是html部分 <html> <body> <for...

php+redis实现注册、删除、编辑、分页、登录、关注等功能示例

php+redis实现注册、删除、编辑、分页、登录、关注等功能示例

本文实例讲述了php+redis实现注册、删除、编辑、分页、登录、关注等功能。分享给大家供大家参考,具体如下: 主要界面 连接redis redis.php <?ph...

PHP切割汉字的常用方法实例总结

本文实例讲述了PHP切割汉字的常用方法。分享给大家供大家参考,具体如下: <?php /* @UTF-8编码的字符可能由1~3个字节组成。 */ /*---------...

phpinfo()中Loaded Configuration File(none)的解决方法

phpinfo()中Loaded Configuration File(none)的解决方法

前言 单独编译php7,并安装在/usr/local/php7/中,今天开发插件修改了 php.ini 的配置信息,但是什么都没生效。 排查 通过phpinfo()查看配置信息:...

php抓取并保存网站图片的实现代码

此程序实现了网页源代码捕获,图片链接获取、分析、并将同样的图片链接合并功能,实现了图片抓取功能。利用php强大的网络内容处理函数将指定的网站上的所有图片抓取下来,保存在当前目录下,以下为...