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设计模式 Adapter(适配器模式)

复制代码 代码如下: <?php /** * 适配器模式 * * 将一个类的接口转换成客户希望的另外一个接口,使用原本不兼容的而不能在一起工作的那些类可以在一起工作 */ // 这...

php简单生成随机颜色的方法

本文实例讲述了php简单生成随机颜色的方法。分享给大家供大家参考,具体如下: <?php //第一种方法: $rand = array('0', '1', '...

PHP 程序员的调试技术小结

PHP 程序员的调试技术小结

本文介绍调试 PHP 应用程序的各种方法,包括在 Apache and PHP 中打开错误报告,以及通过在一个简单的 PHP 脚本中放置策略性的 print 语句,找到更困难的 bug...

php Session存储到Redis的方法

当然要写先安装php的扩展,可参考这篇文章:Redis及PHP扩展安装修改php.ini的设置复制代码 代码如下:session.save_handler = redissession....

thinkphp框架下实现登录、注册、找回密码功能

本文实例为大家分享了thinkphp框架下使用ajax表单提交的登录、注册、找密码的实现方法,以及注册后的用户需后台审核。 user表的字段为id、num、password、name、e...