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通过文件头判断格式的方法。分享给大家供大家参考,具体如下: function judgeFile($file,$form){ if(!empty($file) &...

php使用crypt()函数进行加密

php使用crypt()函数进行加密

一、代码 <?php $str = '应用crypt()函数进行单向加密!'; //声明字符串变量$str echo '加密前$str的值为:'.$s...

php基于PDO连接MSSQL示例DEMO

本文实例讲述了php基于PDO连接MSSQL的方法。分享给大家供大家参考,具体如下: <?php try { $hostname='117.79.93.222';...

php intval的测试代码发现问题

<?php $o = 0.1; for($a = 1; $a < 100; $a++){ &n...

php实现编辑和保存文件的方法

本文实例讲述了php实现编辑和保存文件的方法。分享给大家供大家参考。具体如下: save_file.php: <?php session_start(); $han...