⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 postadd.jsp

📁 jsp bbs源代码
💻 JSP
字号:
<%
/*##################################################################**
**#  LyBBS ver 1.2.b2 (1.2.beta-2版) / 凌云论坛 ver 1.2.b2         #**
**#                                                                #**
**#  版权所有: 凌云工作室 (原流星电脑工作室)                       #**
**#                                                                #**
**#  制作人  : 星语凌 『teddy (Yongshan Ye)』                      #**
**#                                                                #**
**#  主页地址: http://www.unix-now.com/lybbs   凌云论坛主页        #**
**#            http://www.ierp.info/lybbs      凌云论坛镜像站      #**
**#            http://horseye@sina.com/        凌云论坛支持信箱    #**
**#                                                                #**
**##################################################################*/
%>
<%
boolean authorlogin=false;
if(topic==0)
  response.sendRedirect("errorPage.jsp");
if(havepost>0)
  errorinfo="管理员开启了灌水预防机制,"+floodcontrollimit+"秒内不能发帖!";
else if(!postcontent.equals("")) {
  //取父帖的用户信息
  rs=connect.executeQuery("select id,authorid,orderby from posts where db="+db+" and groupid="+topic+" and parentid=0");
  if(rs.next()) {
    postparentid=rs.getInt(1);
    postparentauthorid=rs.getInt(2);
    orderby=rs.getInt(3);
  }
  if(postparentauthorid!=0) {
    //增加用户货币值
    rs=connect.executeQuery("select addmoney,addexperience,addcharm from encourage where id=1");
    if(rs.next()) {
      addmoney=rs.getInt(1);
      addexperience=rs.getInt(2);
      addcharm=rs.getInt(3);
      connect.executeUpdate("update author set money=money+"+addmoney+",experience=experience+"+addexperience+",charm=charm+"+addcharm+" where id="+postparentauthorid);
    }
  }
  if(postparentid!=0) {
    rs=connect.executeQuery("select max(orderby) from posts where db="+db);
    if(rs.next())
      maxorderby=rs.getInt(1);
    if(maxorderby>orderby) {
      orderby=maxorderby+1;
    }
    if(cookiemode.equals("1")) {
      if(!postpassword.equals("")) {
        rs=connect.executeQuery("select id from author where username='"+postusername+"' and password='"+postpassword+"'");
        if(rs.next())
          postauthorid=rs.getInt(1);
        if(postauthorid!=0) {
          cookiename=postusername;
          cookieid=String.valueOf(postauthorid);
          authorlogin=true;
          if(orderby>maxorderby)
            connect.executeUpdate("update posts set orderby="+orderby+" where db="+db+" and groupid="+topic);
          postok=connect.executeUpdate("insert into posts (db,groupid,orderby,authorid,author,parentid,content,postat,ipfrom,titleimage) values ("+db+","+topic+","+orderby+","+cookieid+",'"+cookiename+"',"+postparentid+",'"+postcontent+"',now(),'"+postipfrom+"','"+posticon+"')");
          //增加用户货币值
          connect.executeUpdate("update author set money=money+"+addmoney+",experience=experience+"+addexperience+",charm=charm+"+addcharm+",nreply=nreply+1 where id="+postauthorid);
        }
        else {
          errorinfo="用户名或密码不正确!请重新输入!";
        }
      }
      else {
        if(startnewthreads.equals("all")) {
          if(orderby>maxorderby)
            connect.executeUpdate("update posts set orderby="+orderby+" where db="+db+" and groupid="+topic);
          postok=connect.executeUpdate("insert into posts (db,groupid,orderby,authorid,author,parentid,content,postat,ipfrom,titleimage) values ("+db+","+topic+","+orderby+",0,'访客',"+postparentid+",'"+postcontent+"',now(),'"+postipfrom+"','"+posticon+"')");
        }
        else
          errorinfo="不是开放论坛!您必须先登录或输入正确的用户名和密码!";
      }
    }
    else {
      if(orderby>maxorderby)
        connect.executeUpdate("update posts set orderby="+orderby+" where db="+db+" and groupid="+topic);
      postok=connect.executeUpdate("insert into posts (db,groupid,orderby,authorid,author,parentid,content,postat,ipfrom,titleimage) values ("+db+","+topic+","+orderby+","+cookieid+",'"+cookiename+"',"+postparentid+",'"+postcontent+"',now(),'"+postipfrom+"','"+posticon+"')");
      //增加用户货币值
      connect.executeUpdate("update author set money=money+"+addmoney+",experience=experience+"+addexperience+",charm=charm+"+addcharm+",nreply=nreply+1 where id="+cookieid);
    }
  }
  else
    errorinfo="出现致命错误!可能是原帖已经被删除!请向本站报告这页错误!谢谢!";
}
else
  errorinfo="必须输入内容!";
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebordercolor%> align=center>
 <tr>
  <td>
   <table cellpadding=6 cellspacing=1 border=0 width=100%>
    <tr>
     <td bgcolor=<%=miscbacktwo%> align=center>
      <font color=<%=fontcolormisc%>><b>
<%
if(postok) {
  if(cookiemode.equals("1") && !authorlogin)
    out.println("谢谢,访客!您的新回复已经发表成功!");
  else
    out.println("谢谢,"+cookiename+"!您的新回复已经发表成功!");
}
else {
    out.println("错误: 发表新回复!");
}
%>
      </b></font>
     </td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>>
      <font color=<%=fontcolormisc%>>
<%
if(postok) {
%>
        如果浏览器没有自动返回,请点击下面的链接!
        <ul>
         <li><a href="topic.jsp?db=<%=db%>&topic=<%=topic%>">返回新回复</a>
         <li><a href="db.jsp?db=<%=db%>">返回论坛</a>
         <li><a href="index.jsp">返回论坛首页</a>
         <li><a href="postings.jsp?action=lock&db=<%=db%>&topic=<%=topic%>&checked=yes">锁定贴子</a>
        </ul>
        <meta http-equiv="refresh" content="3; url=db.jsp?db=<%=db%>">
<%
}
else {
%>
        <b>关于发表新回复错误的详细原因:</b>
        <ul>
         <li><b><%=errorinfo%></b>
         <li>您是否需要查看<a href="javascript:openScript('help.jsp',500,400)">帮助文件</a>?
        </ul>
        <b>产生发表新回复错误的可能原因:</b>
        <ul>
         <li>密码错误
         <li>用户名错误
         <li>您不是<a href="register.jsp" >注册</a>用户
        </ul>
        <br><br>
        <center> << <a href="javascript:history.go(-1)">返回上一页</a></center>
<%
}
%>
      </font>
     </td>
    </tr>
   </table>
  </td>
 </tr>
</table>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -