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 病毒

相关文章

有关phpmailer的详细介绍及使用方法

第一,需要下载PHPMailer文件包phpmailer. http://phpmailer.sourceforge.net/第二,确认你的服务器系统已经支持socket ,通过phpi...

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

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

PHP设计模式之装饰器模式定义与用法简单示例

本文实例讲述了PHP设计模式之装饰器模式定义与用法。分享给大家供大家参考,具体如下: 装饰器模式: 如果已有对象的部分内容或功能性发生改变,但是不需要修改原始对象的结构或不使用继承,动态...

PHP与SQL注入攻击[二]

PHP与SQL注入攻击[二] Magic Quotes 上文提到,SQL注入主要是提交不安全的数据给数据库来达到攻击目的。为了防止SQL注 入攻击,PHP自带一个功能可以对输入...

PHP中使用OpenSSL生成证书及加密解密

依赖于OpenSSL扩展 /*加密解密*/ function authcode($string, $operation = 'E') { $ssl_public = file_g...