网站不良信息在线检查系统
<!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=gb2312" />
<title>网站不良信息在线检查系统</title>
</head>
<body>
<div align="center">
<FORM method='get' action='check.php?site=".$_GET[site]."' target="_self">
<input id='site' name='site' value="请输入网址">
<INPUT type=submit value="不加www">
</FORM>
</div>
<?
error_reporting(0);
if(!$_GET[site])
{
echo "<div align="center">";
echo "<a href='http://www.111cn.net' target='_blank'>中国WEB第一站</a> <script language="javascript" type="text/javascript" src="http://js.users.51.la/296026.js"></script>
<noscript><a href="" target="_blank"><img alt="我要啦免费统计" src="http://img.users.51.la/296026.asp" style="border:none" /></a></noscript>";
echo "</div>";
exit;
}
echo "<script src='check.php?site=".$_GET[site]."'></script>";
echo "检测完毕 <a href='http://' target='_blank'></a> <script language="javascript" type="text/javascript" src="http://js.users.51.la/296026.js"></script>
<noscript><a href="" target="_blank"><img alt="我要啦免费统计" src="http://img.users.51.la/296026.asp" style="border:none" /></a></noscript>";
?>
</body>
</html>
check.php文件
<?php
error_reporting(0);
$site=$_GET[site]; //获取网址
if (!$site){echo "请填写完整url"; exit;}
if((!$censorFile=fopen("CensorWords.txt","r")))
{
print("找不到敏感词汇样本文件");
exit;
}
echo "<center>";
echo "<img src="images/17.jpg" alt="构建和谐社会,人人有责!"><br><br>";
echo "<div align="left" style="width:468px">";
$censorFile=file("CensorWords.txt");
foreach ($censorFile as $censorWords)
{
$censorWords=rtrim($censorWords,"nr");
$handle = @fopen("http://www.baidu.com/s?q1=site%3A".$site."&q2=".$censorWords,"r");
if ($handle) {
while (!feof($handle))
{
$buffer = fgets($handle, 12000);
//print ($buffer);//输出Buffer,调试用
$listWords.=cut($buffer,"百度一下,找到相关网页","篇");
}
fclose($handle);
}
if ($listWords){
echo "存在非法内容:".$listWords."条记录<a href='http://www.baidu.com/s?tn=macdown&ct=0&ie=gb2312&bs=site%3A".$site."&sr=1&z=&cl=3&f=8&wd=".$censorWords."' target=_blank>$censorWords</a><br>";
$listWords="";}//清空关键词
}
echo "<br><br><strong>检测完毕,请及时删除不良信息!</strong><br>";
function cut($file,$from,$end){
$message=explode($from,$file);
$message=explode($end,$message[1]);
return $message[0];
}
?>