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 判断页面或图片是否经过gzip压缩的方法

使用php判断页面或图片是否经过gzip压缩方法 1.使用get_headers 页面内容 <?php ob_start('ob_gzhandler'); // 开启...

解析php中获取系统信息的方法

$root = getenv('DOCUMENT_ROOT'); ////服务器文档根目录$port = getenv('SERVER_PORT'); ////服务器端口$file =...

用PHP生成html分页列表的代码

<?php $db = mysql_connect("127.0.0.1","root","*******") or die("cant't...

浅谈php处理后端&接口访问超时的解决方法

【HTTP访问】 一般我们访问HTTP方式很多,主要是:curl, socket, file_get_contents() 等方法。 如果碰到对方服务器一直没有响应的时候,我们就悲剧了,...

php基于登陆时间判断实现一天多次登录只积分一次功能示例

本文实例讲述了php基于登陆时间判断实现一天多次登录只积分一次功能。分享给大家供大家参考,具体如下: 在网上找了很多的案例,感觉都差不多,有的还比较的繁琐,就自己尝试了一下,如何实现这个...