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

📄 postnew.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(havepost>0)
  errorinfo="管理员开启了灌水预防机制,"+floodcontrollimit+"秒内不能发帖!";
else if(!posttitle.equals("")) {
  //增加用户货币值
  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);
  }
  rs=connect.executeQuery("select max(orderby) from posts where db="+db);
  if(rs.next())
    maxorderby=rs.getInt(1)+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;
        postok=connect.executeUpdate("insert into posts (db,groupid,orderby,authorid,author,title,content,postat,ipfrom,titleimage) values ("+db+","+maxorderby+","+maxorderby+","+cookieid+",'"+cookiename+"','"+posttitle+"','"+postcontent+"',now(),'"+postipfrom+"','"+posticon+"')");
        //增加用户货币值
        connect.executeUpdate("update author set money=money+"+addmoney+",experience=experience+"+addexperience+",charm=charm+"+addcharm+",nposts=nposts+1 where id="+postauthorid);
      }
      else {
        errorinfo="用户名或密码不正确!请重新输入!";
      }
    }
    else {
      if(startnewthreads.equals("all")) {
        postok=connect.executeUpdate("insert into posts (db,groupid,orderby,authorid,author,title,content,postat,ipfrom,titleimage) values ("+db+","+maxorderby+","+maxorderby+",0,'访客','"+posttitle+"','"+postcontent+"',now(),'"+postipfrom+"','"+posticon+"')");
      }
      else
        errorinfo="不是开放论坛!您必须先登录或输入正确的用户名和密码!";
    }
  }
  else {
    postok=connect.executeUpdate("insert into posts (db,groupid,orderby,authorid,author,title,content,postat,ipfrom,titleimage) values ("+db+","+maxorderby+","+maxorderby+","+cookieid+",'"+cookiename+"','"+posttitle+"','"+postcontent+"',now(),'"+postipfrom+"','"+posticon+"')");
    //增加用户货币值
    connect.executeUpdate("update author set money=money+"+addmoney+",experience=experience+"+addexperience+",charm=charm+"+addcharm+",nposts=nposts+1 where id="+cookieid);
  }
}
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=<%=maxorderby%>">返回新主题</a>
         <li><a href="db.jsp?db=<%=db%>">返回论坛</a>
         <li><a href="index.jsp">返回论坛首页</a>
         <li><a href="postings.jsp?action=locktop&db=<%=db%>&topic=<%=maxorderby%>">新主题固顶</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 + -