文章推荐系统(二)
(编辑:jimmy 日期: 2024/11/18 浏览:3 次 )
======APPRE.PHP==========
$strlen=strlen($articlemsg);
if($strlen<50){
echo "<table align=center width=100%>";
echo "<tr align=center><td>";
echo"你是不是在灌水呀?为防止部分网友善意的灌水,本站规定你所提交的文章";
echo"</td></tr>";
echo"<tr align=center><td>";
echo"的长度必须大于50个汉字。请你重新提交文章。谢谢";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"<a href=appre.htm>【重新提交文章】</a>  ";
echo"<a href=index.php>【返回到主页】</a>";
echo"</td></tr>";
echo"</table>";
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td>";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
exit;
}
$strlen=strlen($name);
if($strlen<=1){
echo"<table align=center width=100%>";
echo"<tr align=center><td>";
echo"请你正确输入你的名字";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"【<a href=appre.htm>重新提交文章</a>】  ";
echo"【<a href=index.php>返回主页</a>】";
echo"</td></tr>";
echo"</table>";
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td>";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
exit;
}
@$conn=mysql_connect("localhost","user","password");
mysql_select_db("bamboo");
$sql="select*from article where articlename='$articlename'";
$result=mysql_query($sql,$conn);
if($result){
if(mysql_fetch_object($result)){
echo"<table align=center width=100%>";
echo"<tr><td align=center>";
echo"你所推荐的文章已经存在了";
echo"</td>";
echo"<td align=center>";
echo"<a href=appre.htm>重新推荐下一篇文章</a>";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"如果你确信本站没有你所推荐的文章,请你点<a href=mailto:webinfro@163.com>这里</a>与此同时Bamboo联系";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"【<a href=appre.htm>重新发表新的文章</a>】";
echo"【<a href=index.php>返回主页</a>】";
echo"</td></tr>";
echo"</table>";
mysql_close($conn);
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td>";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
exit;}
}
$sql="select *from article where name=$name";
$result=mysql_query($sql,$conn);
if($result){
if(mysql_fetch_object($result)){
echo"<table width=100% align=center>";
echo"<tr align=center>";
echo"<td align=center>";
echo"本站数据库记录显示已经有一个和你同名的记录,请你换一个名字重新发表文章";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"<a href=appre.htm>重新发表文章</a>";
echo"<a href=index.php>返回主页</a>";
echo"</td></tr>";
echo"</table>";
mysql_close($conn);
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td>";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
exit;
}
}
echo $webadd1;
$sql="insert into article(name,webname,webadd,weblogo,articlename,articleauthor,articlemsg) values ('$name','$webname','$webadd','$weblogo','$articlename'
,'$articleauthor'
,'$articlemsg'
)";
//echo mysql_errno().":".mysql_error()."<br>";
if(mysql_query($sql,$conn)){
echo"<table width=100% align=center>";
echo"<tr><td align=center>";
echo"谢谢你,斑竹园的发展离不开你的支持。你提交的文章已经接受";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"【<a href=appre.htm>提交另一篇文章</a>】";
echo"【<a href=index.php>返回主页</a>】";
echo"</td></tr>";
echo"</table>";
mysql_close($conn);
}
else{
echo"<table width=100% align=center>";
echo"<tr><td align=center>";
echo"对不起,你提交的文章出现错误,请你重新提交";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"【<a href=appre.htm>重新提交</a>】";
echo"【<a href=index.php>返回主页</a>】";
echo"</td></tr>";
echo"</table>";
mysql_close($conn);
}
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td> ";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
?>
$strlen=strlen($articlemsg);
if($strlen<50){
echo "<table align=center width=100%>";
echo "<tr align=center><td>";
echo"你是不是在灌水呀?为防止部分网友善意的灌水,本站规定你所提交的文章";
echo"</td></tr>";
echo"<tr align=center><td>";
echo"的长度必须大于50个汉字。请你重新提交文章。谢谢";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"<a href=appre.htm>【重新提交文章】</a>  ";
echo"<a href=index.php>【返回到主页】</a>";
echo"</td></tr>";
echo"</table>";
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td>";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
exit;
}
$strlen=strlen($name);
if($strlen<=1){
echo"<table align=center width=100%>";
echo"<tr align=center><td>";
echo"请你正确输入你的名字";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"【<a href=appre.htm>重新提交文章</a>】  ";
echo"【<a href=index.php>返回主页</a>】";
echo"</td></tr>";
echo"</table>";
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td>";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
exit;
}
@$conn=mysql_connect("localhost","user","password");
mysql_select_db("bamboo");
$sql="select*from article where articlename='$articlename'";
$result=mysql_query($sql,$conn);
if($result){
if(mysql_fetch_object($result)){
echo"<table align=center width=100%>";
echo"<tr><td align=center>";
echo"你所推荐的文章已经存在了";
echo"</td>";
echo"<td align=center>";
echo"<a href=appre.htm>重新推荐下一篇文章</a>";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"如果你确信本站没有你所推荐的文章,请你点<a href=mailto:webinfro@163.com>这里</a>与此同时Bamboo联系";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"【<a href=appre.htm>重新发表新的文章</a>】";
echo"【<a href=index.php>返回主页</a>】";
echo"</td></tr>";
echo"</table>";
mysql_close($conn);
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td>";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
exit;}
}
$sql="select *from article where name=$name";
$result=mysql_query($sql,$conn);
if($result){
if(mysql_fetch_object($result)){
echo"<table width=100% align=center>";
echo"<tr align=center>";
echo"<td align=center>";
echo"本站数据库记录显示已经有一个和你同名的记录,请你换一个名字重新发表文章";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"<a href=appre.htm>重新发表文章</a>";
echo"<a href=index.php>返回主页</a>";
echo"</td></tr>";
echo"</table>";
mysql_close($conn);
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td>";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
exit;
}
}
echo $webadd1;
$sql="insert into article(name,webname,webadd,weblogo,articlename,articleauthor,articlemsg) values ('$name','$webname','$webadd','$weblogo','$articlename'
,'$articleauthor'
,'$articlemsg'
)";
//echo mysql_errno().":".mysql_error()."<br>";
if(mysql_query($sql,$conn)){
echo"<table width=100% align=center>";
echo"<tr><td align=center>";
echo"谢谢你,斑竹园的发展离不开你的支持。你提交的文章已经接受";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"【<a href=appre.htm>提交另一篇文章</a>】";
echo"【<a href=index.php>返回主页</a>】";
echo"</td></tr>";
echo"</table>";
mysql_close($conn);
}
else{
echo"<table width=100% align=center>";
echo"<tr><td align=center>";
echo"对不起,你提交的文章出现错误,请你重新提交";
echo"</td></tr>";
echo"<tr><td align=center>";
echo"【<a href=appre.htm>重新提交</a>】";
echo"【<a href=index.php>返回主页</a>】";
echo"</td></tr>";
echo"</table>";
mysql_close($conn);
}
echo"<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=00FF00>";
echo"<tr>";
echo"<td width=20%>| <a href=index.php>返回首页 </a> </td>";
echo"<td width=20%> | <a href=help.htm> 推荐说明</a>
|</td>";
echo"<td width=20%> <a href=#>搜索文章 </a>
| </td> ";
echo"<td width=20%> <a href=article.php>阅读文章</a>
|</td>";
echo"<td width=20%> <a href=mailto:webinfro@163.com>联系站长</a>
|</td>";
echo"</tr>";
echo"</table>";
?>
下一篇:谈谈PHP语法(5)