模仿OSO的论坛(四)_php基础

reply.php(用来回复主题)
<HTML><HEAD><TITLE>疑难问题</TITLE>
<LINK href="mypic/style.css" rel=STYLESHEET type=text/css></HEAD>
<?php
if (!$cook_user)
{echo "<script language='javascript'>";  
echo "parent.location.href='index.php'";  
echo "</script>";}
else {include ("connect.inc.php");
$query = "select * from my_user where user='".$cook_user."' and password='".$cook_password."'";  
$res = mysql_query($query);  
if (!$res)
{echo "<script language='javascript'>";  
echo "parent.location.href='index.php'";  
echo "</script>";}
include "connect.inc.php";
if ($content) {$content= str_replace ( "'","mysinglequotes",$content);  
$content=htmlspecialchars($content);
$content=nl2br($content);
$query = "INSERT INTO guestbook (name,type,content,icon,time_open,time_close,answer_count,answer_name,main_id) VALUES ('".$cook_user."',0,'".$content."',".$icon.",now(),now(),1,'".$cook_user."',".$theme_id.")";  
$res = mysql_query($query);
if ($res)  
{$query = "update guestbook set time_close=now(),answer_count=answer_count+1,answer_name='".$cook_user."' where id=".$theme_id;  
$res = mysql_query($query);  
if ($res)
{echo "<script language='javascript'>";  
echo "parent.location.href='post_end.php'";
echo "</script>";}}}}
?>
<SCRIPT language=JavaScript>
<!--
var submitcount=0;
function check_com(){
   if(document.form.theme.value.length ==0){
      submitcount--;
      alert("主题不能为空!nYou must supply a subject.");
      return false;
   }

   if(document.form.content.value.length == 0){
      submitcount--;
      alert("加贴内容不能为空!nYou must supply a message.");
      return false;
   }
   return true;
}
//-->
</SCRIPT>
<BODY bgColor=#cccc99 bottomMargin=0 leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<form method="post" action="reply.php" name="form" onSubmit="return check_com()">
<SCRIPT language=JavaScript  
src="mypic/x.js"></SCRIPT>
  <TR>
    <TD vAlign=top>
      <TABLE align=center border=0 cellPadding=4 cellSpacing=0 width=100%>
        <TBODY>
        <TR>
          <TD class=mid width=20%>回复主题<BR><BR></TD>
          <TD class=mid><A class=title  
            href="read.php?theme_id=<?php echo $theme_id ?>">
<?php  
$query = "select theme from guestbook where id=".$theme_id;
$res = mysql_query($query);  
$row = mysql_fetch_row($res);  
echo $row[0];
?>
</A><BR><BR></TD></TR>
        <TR>
          <TD class=mid vAlign=top>表情图标</TD>
          <TD><INPUT CHECKED name=icon type=radio value=1> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon1.gif"  
            width=18><INPUT name=icon type=radio value=2> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon2.gif"  
            width=18><INPUT name=icon type=radio value=3> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon3.gif"  
            width=18><INPUT name=icon type=radio value=4> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon4.gif"  
            width=18><INPUT name=icon type=radio value=5> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon5.gif"  
            width=18><INPUT name=icon type=radio value=6> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon6.gif"  
            width=18><INPUT name=icon type=radio value=7> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon7.gif"  
            width=18><BR><INPUT name=icon type=radio value=8> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon8.gif"  
            width=18><INPUT name=icon type=radio value=9> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon9.gif"  
            width=18><INPUT name=icon type=radio value=10> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon10.gif"  
            width=18><INPUT name=icon type=radio value=11> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon11.gif"  
            width=18><INPUT name=icon type=radio value=12> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon12.gif"  
            width=18><INPUT name=icon type=radio value=13> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon13.gif"  
            width=18><INPUT name=icon type=radio value=14> <IMG  
            align=ABSCENTER height=18  
            src="mypic/icon14.gif"  
            width=18></TD></TR>
        <TR>
          <TD class=mid vAlign=top><input type="hidden" name="theme_id" size="12" class="stedit" value="<?php echo $theme_id ?>">
          加贴内容</TD>
          <TD><TEXTAREA cols=50 name=content rows=6></TEXTAREA> </TD></TR>
        <TR>
          <TD> </TD>
          <TD><INPUT name=submit onclick="return checkSubmit()" type=submit value=" 发 表 ">  
                   <INPUT name=reset type=reset value=" 清 除 "> </TD></TR>
               </FORM>
        <TR>
          <TD colSpan=2><BR><BR><FONT color=#797979>
            <LI>本主题最后 5 个帖子 (按发帖时间倒序排列)</FONT></LI></TD></TR></TBODY></TABLE>
      <TABLE align=center bgColor=#000000 border=0 cellPadding=4 cellSpacing=1  
      width=100%>
        <TBODY>
        <TR bgColor=#666666>
          <TD width="10%"><FONT color=#ffffff>作 者</FONT></TD>
          <TD width="90%"><FONT color=#ffffff>内 容</FONT></TD></TR>
<?php
$query = "select * from guestbook where main_id=".$theme_id." or id=".$theme_id." order by time_open DESC limit 5 ";
$res = mysql_query($query);  
function TdBackColor() {
  static $ColorStr;
  if ($ColorStr=="#ededed") {
    $ColorStr="#dedede";
  } else {
    $ColorStr="#ededed";
  }
  return($ColorStr);
}
for ($i=1;$i<=5;$i++)
{$row = @mysql_fetch_array($res);  
if (!$row) break;  
$ColorStr=TdBackColor();
echo "<TR bgColor=".$ColorStr.">";
echo "<TD vAlign=top>".$row['name']."</td>";  
$content= str_replace ( "mysinglequotes","'",$row['content']);  
echo "<td>".$content."</td></tr>";  
}
?>      
</TBODY></TABLE>
</TBODY></TABLE>
</FORM>
</html>  

【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    

时间: 2024-08-28 14:33:22

模仿OSO的论坛(四)_php基础的相关文章

模仿OSO的论坛(一)_php基础

     相信每一个到过OSO的人都会对OSO的论坛留下极深的印象,这个论坛无论从那一方面来说都是比较出色的.你想不想你的主页也有这么一个漂亮的论坛呢,其实并不太复杂的,下面我们仅从一些基本的部分来实现对OSO论坛的模仿.     由于我仅仅是使用这个论坛作为我的留言板,所以我的论坛可以算是OSO论坛的简配.1.在我的论坛中只有在用户登录后才能发言,用户的ID是存在一个叫"cookie_user"的cookie变量中的,2.我的论坛没有子论坛,3.我没有统计一个主题的点击数,4.在OS

模仿OSO的论坛(一)

  相信每一个到过OSO的人都会对OSO的论坛留下极深的印象,这个论坛无论从那一方面来说都是比较出色的.你想不想你的主页也有这么一个漂亮的论坛呢,其实并不太复杂的,下面我们仅从一些基本的部分来实现对OSO论坛的模仿.     由于我仅仅是使用这个论坛作为我的留言板,所以我的论坛可以算是OSO论坛的简配.1.在我的论坛中只有在用户登录后才能发言,用户的ID是存在一个叫"cookie_user"的cookie变量中的,2.我的论坛没有子论坛,3.我没有统计一个主题的点击数,4.在OSO论坛

一个模仿oso的论坛程序(之一)

我经常使用oso的论坛,个人感觉挺好的,因此模仿oso的界面编了一个程序,与大家共享. 程序由三部分组成,即显示主题信息,显示论坛信息,增加论坛信息,主题与论坛内容采用主从表关系. 表结构如下: drop table fr_t_forumtitle; create table fr_t_forumtitle(    id         integer,    state      varchar(1),    readcount  integer,    replycount integer,

模仿OSO的论坛(五)_php基础

在前面的post.php及reply.php中,在发言提交成功后都跳转到一个叫post_end.php的页面,这个页面主要是提示发言提交成功,并给出了一个到faq.php的链接,程序非常简单,我就一并写在下面了: <html> 你的发言已提交<br> <a href="faq.php">返回疑难问题首页</a> </html>     在这一节中,我们将着力讨论如果实现我们在开头所列出的本论坛所缺少的八项功能:     1.在

模仿OSO的论坛(三)_php基础

post.php(发新贴子) <HTML><HEAD><TITLE>疑难问题</TITLE> <LINK href="mypic/style.css" rel=STYLESHEET type=text/css></HEAD> <?php if (!$cookie_user) {echo "<script language='javascript'>";  echo "

模仿OSO的论坛(二)_php基础

read.php(用来显示相关主题内容) <HTML><HEAD><TITLE>疑难问题</TITLE> <LINK href="mypic/style.css" rel=STYLESHEET type=text/css></HEAD> <BODY bgColor=#cccc99 bottomMargin=0 leftMargin=0 topMargin=0 marginwidth="0"

我的论坛源代码(四)_php基础

POST.PHP发布主题的页面,发布的信息提交到OKEY.PHP中去处理. <html> <head> <title>论坛发帖</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <STYLE type=text/css> P {FONT-FAMILY: normal; FONT-SIZE: 9

模仿OSO的论坛(四)

reply.php(用来回复主题) <HTML><HEAD><TITLE>疑难问题</TITLE> <LINK href="mypic/style.css" rel=STYLESHEET type=text/css></HEAD> <?php if (!$cook_user) {echo "<script language='javascript'>";  echo "

模仿OSO的论坛(五)

在前面的post.php及reply.php中,在发言提交成功后都跳转到一个叫post_end.php的页面,这个页面主要是提示发言提交成功,并给出了一个到faq.php的链接,程序非常简单,我就一并写在下面了: <html> 你的发言已提交<br> <a href="faq.php">返回疑难问题首页</a> </html>     在这一节中,我们将着力讨论如果实现我们在开头所列出的本论坛所缺少的八项功能:     1.在