background image

$ext

=

substr

(

strrchr

(

$file

,"."), 1);

if

( in_array(

$ext

 , 

$arrext

) ){

echo

 "<li>$file ";

$body

 = 

file_get_contents

(

$dir

.'/'.

$file

); 

if

(

$isreg

 == 1){

$body2

 = preg_replace(

$sstr

$rpstr

$body

);

}

else

{

$body2

 = 

str_replace

(

$sstr

$rpstr

$body

);

}

if

(

$body

 != 

$body2

 && 

$body2

 != ''){ 

tofile(

$dir

.'/'.

$file

,

$body2

);

echo

 ' OK';

}

else

{

echo

 ' NO';

}

echo

 '</li>';

}
}
}

closedir

(

$dh

);

}
}

//把生成文件的过程写出函数
function

 tofile(

$file_name

,

$file_content

){

if

 (

is_file

 (

$file_name

)){

@unlink (

$file_name

);

}

$handle

 = 

fopen

 (

$file_name

,"w");

if

 (!

is_writable

 (

$file_name

)){

return

 false;

}

if

 (!fwrite (

$handle

,

$file_content

)){

return

 false;

}
fclose (

$handle

); 

//关闭指针

return

 

$file_name

;

}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

§

">

<html xmlns="

http://www.w3.org/1999/xhtml

§

">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>批量替换程序|木马批量删除_www.itlearner.com</title>
<style type="text/css">