BBS(php & mysql)完整版(一)
//此页面为say.php
<? include "signup/mysql.inc"; if($id1){ $sql="select * from $table where id='$id1'"; //显示回复题目 $result=mysql_query($sql)or die(mysql_error()); $row=mysql_fetch_array($result); $title="RE:".$row["title"]; } $ip=$REMOTE_ADDR; $sql="select * from user_stus where ip='$ip'"; //查询当前用户名 $result=mysql_query($sql)or die(mysql_error()); $row=mysql_fetch_array($result); if(!$row) //判断用户是否登陆 { echo "<html><div id=Layer2 align=center z-index:1><BR><BR><BR><BR>"; echo" <div id=Layer3 align=center z-index:2><img src=pic/3.gif width=15 height=15></div>"; echo" <div align=center>"; echo" <p><font size=2 color=#FF33CC>嘻嘻!! 请先登陆</font></p>"; echo"<p><font size=2 color=#FF33CC><a href='".$PHP_SELF."?p=1&&table=$table'>返回</a></font></p> </div> </html>"; exit(); } else $userid=$row["userid"]; if($ok) { if($title==""||$content=="") { echo "<BR> 请您添完整后提交"; } else{ $id=time(); //提交文章 $date1=date("Y/m/d"); $title=htmlspecialchars($title); $content=htmlspecialchars($content); $sql="select * from ".$table; $result=mysql_query($sql)or die(mysql_error()); $row1=mysql_num_rows($result); $row1++; if($id1){ $sql="insert into bbs_re (id,userid,date1,title,content)values('$id','$userid','$date1','$title','$content')"; mysql_query($sql)or die(mysql_error()); $sql="select * from ".$table." where id='$id1'"; $result=mysql_query($sql)or die(mysql_error()); $lin=mysql_fetch_array($result); for($i=1;$i<6;$i++) { $re="r".$i; if(!$lin["$re"]) break; } $sql="update ".$table." set ".$re."='$id' where id='$id1'"; } else $sql="insert into ".$table." (id,userid,date1,title,content,row)values('$id','$userid','$date1','$title','$content','$row1')"; $result=mysql_query($sql)or die(mysql_error()); if($result) { header("Location:php3.php?p=1&&table=$table"); exit ; } } } ?> <html> <head> <title>xiaoyang</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script language="JavaScript1.2" src="js/menu_comment.js"></script> <script language="JavaScript1.2" src="js/fw_menu.js"></script> 上一篇:建立动态的WML站点(三) 下一篇:BBS(php & mysql)完整版(二) 更多相关文章
|
推荐文章
精彩文章
|