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中执行系统命令的方法。分享给大家供大家参考。具体分析如下: 在php中执行系统命令,如LS <?php // exec.php $cmd = "di...

PHP获取文件后缀名的三个函数

选好一种记住,以后需要使用的时候就可以直接使用,或者来本站查看本文也是可以滴。 复制代码 代码如下: <?php //方法一: function extend_1($file_na...

php向js函数传参的几种方法

<?php echo "<script>test('$_POST[userid]');</script> "; ?> 在上面的...

学习php设计模式 php实现策略模式(strategy)

学习php设计模式 php实现策略模式(strategy)

一、意图 定义一系列的算法,把它们一个个封装起来,并且使它们可相互替换。策略模式可以使算法可独立于使用它的客户而变化 策略模式变化的是算法 二、策略模式结构图   三、策略模式...

高质量PHP代码的50个实用技巧必备(上)

50个高质量PHP代码的实用技巧,希望大家喜欢。 1.不要使用相对路径 常常会看到: require_once('../../lib/some_class.php'); 该...