<?php 
if($_POST){
if(is_file("filterwords.txt")){
$filter_word=file("filterwords.txt");
$str=$_POST['neirong'];
for($i=0;$i<count($filter_word);$i++){
if(preg_match("/".trim($filter_word[$i])."/i",$str)){
echo "<script>alert('error word in line');history.back(-1);</script>";
exit;
}
}
}



}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="" method="post">
<textarea cols="60" rows="20" name="neirong" value=""></textarea>
<input type="submit" value="提交" name="">
</form>
</body>
</html>