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分页时出现的Fatal error的解决方法

Fatal error: Cannot redeclare htmtocode() (previously declared in D:\www_local\mytest\conn.ph...

原生JS实现Ajax通过POST方式与PHP进行交互的方法示例

原生JS实现Ajax通过POST方式与PHP进行交互的方法示例

本文实例讲述了原生JS实现Ajax通过POST方式与PHP进行交互的方法。分享给大家供大家参考,具体如下: 一、代码 conn.php <?php $conn=m...

PHP 自定义错误处理函数trigger_error()

定义和用法trigger_error() 函数创建用户定义的错误消息。 trigger_error() 用于在用户指定的条件下触发一个错误消息。它与内建的错误处理器一同使用,也可以与由...

PHP $_FILES函数详解

如: 复制代码 代码如下: <form enctype="multipart/form-data" action="upload.php" method="post"> &l...

php foreach 参数强制类型转换的问题

所以,为了防止这样的信息出现,我使用foreach的时候,都会把参数进行强制类型转换,形势如下: foreach((array)$arr as $key => $value); 这...