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中字符查找函数strpos、strrchr与strpbrk用法

本文实例讲述了php中字符查找函数strpos、strrchr与strpbrk用法。分享给大家供大家参考。具体如下: ① strpos() 函数返回字符串在另一个字符串中第一次出现的位置...

PHP实现的AES双向加密解密功能示例【128位】

本文实例讲述了PHP实现的AES双向加密解密功能。分享给大家供大家参考,具体如下: <?php /* * Created on 2018-9-1 * * To c...

从手册去理解分析PHP session机制

session.save_handler = files 1. session_start() session_start()是session机制的开始,它有一定概率开启垃圾回收,因为s...

php中curl、fsocket、file_get_content三个函数的使用比较

抓取远程内容,之前一直都在用file_get_content函数,其实早就知道有curl这么一个好东西的存在,但是看了一眼后感觉使用颇有些复杂,没有file_get_content那么简...

php抓取页面与代码解析 推荐

得到数据我们不能直接输出,往往需要对内容进行提取,然后再进行格式化,以更加友好的方式显现出来。下面先简单说一下本文的主要内容: 一、 PHP抓取页面的主要方法: 1. file()函数...