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

📄 postings.jsp

📁 jsp bbs源代码
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%
/*##################################################################**
**#  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/        凌云论坛支持信箱    #**
**#                                                                #**
**##################################################################*/
%>
<%@ include file="include/config.jsp"%>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ include file="include/connect.jsp"%>
<%
int db=0,topic=0;
String tempSTR="",action="",submit="";
//取传递变量
tempSTR=request.getParameter("db");
if(tempSTR!=null && !tempSTR.equals(""))
  db=Integer.parseInt(tempSTR);
tempSTR=request.getParameter("topic");
if(tempSTR!=null && !tempSTR.equals(""))
  topic=Integer.parseInt(tempSTR);
tempSTR=request.getParameter("action");
if(tempSTR!=null)
  action=tempSTR;
//用户cookie变量声明
int id=0,styleid=0,membergone=0;
String cookieid="",cookiename="",username="",usermode="",cookiemode="";
//日期定义
int now_year=0,now_month=0,now_day=0,now_hour=0,now_minute=0,now_second=0;
String now_date="",now_time="";
//定义boardprepare.jsp中的变量
String onlineview="",dispview="",boardtitle="",boardname="",title="",version="",copyright="",support="",programmer="",programemail="",homename="",homeurl="",togb="1",status="",maintainreason="",announcement="1",boardurl="",showfastlogin="",dispborn="",styleQuery="";
//定义本页变量
int isadmin=0,maxtopic=0,movetodb=0,adminparentid=0,postdeleteid=0,postid=0,maxorderby=0,orderby=0;
String errortitle="操作失败",errorinfo="不知名错误!请联系管理员!",righttitle="",rightinfo="",postauthor="",leavemessage="",admincontent="",movefromdbname="",movetodbname="",movetitle="",postvote="";
boolean isauthor=false,postok=false;
ResultSet rs2;
int postparentid=0;
%>
<%@ include file="include/boardprepare.jsp"%>
<%@ include file="include/style.jsp"%>
<%@ include file="include/dbstyle.jsp"%>
<%
if(!action.equals("")) {
  tempSTR=request.getParameter("request");
  if(tempSTR!=null)
    submit=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
  if(cookiemode.equals("4"))
    isadmin=1;
  else
    isadmin=connect.getRowNum("admin where db="+db+" and authorid="+cookieid);
  if(action.equals("lock") || action.equals("unlock") || action.equals("delete") || action.equals("directdel")) {
    rs=connect.executeQuery("select author from posts where db="+db+" and groupid="+topic+" and parentid=0");
    if(rs.next()) {
      postauthor=rs.getString(1);
    }
    if(!postauthor.equals("") && !postauthor.equals("客人") && postauthor.equals(cookiename))
      isauthor=true;
    else
      isauthor=false;
  }
  if(action.equals("directdel")) {
    tempSTR=request.getParameter("postid");
    if(tempSTR!=null)
      postid=Integer.parseInt(tempSTR);
  }
}
%>
<!--//html from here-->
<%@ include file="include/head.jsp"%>
<script language="JavaScript">
function delposts(s) {
 var cancel=window.confirm("您确定要删除组号为 "+s+" 的帖子吗?\n(警告:所有的属于这个帖子的回复帖也将同时被删除!)");
 if(cancel)
   document.delposts.submit();
}
function delreply(s) {
 var cancel=window.confirm("您确定要删除id号为 "+s+" 的回复帖吗?");
 if(cancel)
   document.delreply.submit();
}
</script>
<body <%=lbbody%>>
<%@ include file="include/userheader.jsp"%>
<p>
<%
String vicedbname="";
rs=connect.executeQuery("select dbname from db where id="+db);
if(rs.next())
  vicedbname=rs.getString(1);
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> align=center>
 <tr>
  <td width=30% rowspan=2 valign=top>
   <%@ include file="include/viceadbanner.jsp"%>
  </td>
  <td valign=top align=left>
     <font face="宋体" color=<%=fontcolormisc%>>
     <img src="images/closedfold.gif" border=0> <a href="index.jsp"><%=boardname%></a><br>
     <img src="images/bar.gif" border=0><img src="images/closedfold.gif" border=0> <a href="db.jsp?db=<%=db%>"><%=vicedbname%></a><br>
     &nbsp;&nbsp;&nbsp;<img src="images/bar.gif" border=0><img src="images/openfold.gif" border=0> <%if(action.equals("jinghua")) out.print("标记精华帖子"); else if(action.equals("canceljinghua")) out.print("取消精华帖子"); else if(action.equals("locktop")) out.print("固定帖子顶端"); else if(action.equals("unlocktop")) out.print("取消帖子固顶"); else if(action.equals("puttop")) out.print("提前帖子"); else if(action.equals("lock")) out.print("锁定帖子"); else if(action.equals("unlock")) out.print("解锁帖子"); else if(action.equals("delete") || action.equals("directdel")) out.print("删除帖子"); else if(action.equals("movetopic")) out.print("移动帖子");%>
     </font>
  </td>
 </tr>
</table>
<p>
<%
if(action.equals("jinghua")) {
  if(isadmin>0) {
    postok=connect.executeUpdate("update posts set jinghua='1' where db="+db+" and groupid="+topic+" and parentid=0 and jinghua='0'");
    if(postok) {
      righttitle="提取精华帖成功";
      rightinfo="您已经成功的把您选择的帖子提到论坛的精华区!";
    }
  }
  else {
    errortitle="提升为精华帖失败";
    errorinfo="这个操作必须由这个版的斑竹或副斑竹完成!";
  }
}
else if(action.equals("canceljinghua")) {
  if(isadmin>0) {
    postok=connect.executeUpdate("update posts set jinghua='0' where db="+db+" and groupid="+topic+" and parentid=0 and jinghua='1'");
    if(postok) {
      righttitle="取消精华帖成功";
      rightinfo="您已经成功的取消了您选择的精华帖!";
    }
  }
  else {
    errortitle="取消精华帖失败";
    errorinfo="这个操作必须由这个版的斑竹或副斑竹完成!";
  }
}
else if(action.equals("lock")) {
  if(isadmin>0 || isauthor) {
    if(connect.getRowNum("posts where db="+db+" and groupid="+topic+" and parentid=0 and vote='1'")==0)
      postok=connect.executeUpdate("update posts set titlelock='1' where db="+db+" and groupid="+topic+" and parentid=0 and titlelock='0'");
    else
      postok=connect.executeUpdate("update posts set titlelock='1',top='0' where db="+db+" and groupid="+topic+" and parentid=0 and titlelock='0'");
    if(postok) {
      righttitle="锁定帖子成功";
      rightinfo="您已经成功的把帖子锁定!现在开始不允许被回复!";
    }
  }
  else {
    errortitle="锁定帖子失败";
    errorinfo="这个操作必须由这个版的斑竹或副斑竹或发帖人完成!";
  }
}
else if(action.equals("unlock")) {
  if(isadmin>0 || isauthor) {
    postok=connect.executeUpdate("update posts set titlelock='0' where db="+db+" and groupid="+topic+" and parentid=0 and titlelock='1'");
    if(postok) {
      righttitle="解锁帖子成功";
      rightinfo="您已经成功的把帖子解锁!现在已经可以被回复!";
    }
  }
  else {
    errortitle="解锁帖子失败";
    errorinfo="这个操作必须由这个版的斑竹或副斑竹或发帖人完成!";
  }
}
else if(action.equals("locktop")) {
  if(isadmin>0) {
    int nowtoptopic=0;
    nowtoptopic=connect.getRowNum("posts where db="+db+" and top='1'");
    if(nowtoptopic<maxtoptopic) {
      postok=connect.executeUpdate("update posts set top='1' where db="+db+" and groupid="+topic+" and parentid=0 and top='0'");
      if(postok) {
        righttitle="固定顶端成功";
        rightinfo="您已经成功的把帖子固定在最顶端!";
      }
    }
    else {
      errortitle="固定顶端失败";
      errorinfo="已经有"+nowtoptopic+"条固顶项目!最大允许"+maxtoptopic+"条固顶项目!";
    }
  }
  else {
    errortitle="固定顶端失败";
    errorinfo="这个操作必须由这个版的斑竹或副斑竹完成!";
  }
}
else if(action.equals("unlocktop")) {
  if(isadmin>0) {
    postok=connect.executeUpdate("update posts set top='0' where db="+db+" and groupid="+topic+" and parentid=0 and top='1'");
    if(postok) {
      righttitle="取消固定顶端成功";
      rightinfo="您已经成功的取消了把帖子固定在最顶端!";
    }
  }
  else {
    errortitle="取消固定顶端失败";
    errorinfo="这个操作必须由这个版的斑竹或副斑竹完成!";
  }
}
else if(action.equals("puttop")) {
  if(isadmin>0) {
    rs=connect.executeQuery("select orderby from posts where db="+db+" and groupid="+topic+" and parentid=0");
    if(rs.next())
      orderby=rs.getInt(1);
    rs=connect.executeQuery("select max(orderby) from posts where db="+db);
    if(rs.next()) {
      maxorderby=rs.getInt(1);
      if(maxorderby==orderby) {
        errortitle="提前帖子失败";
        errorinfo="您所提前的帖子已经处在最上面!";
      }
      else {
        postok=connect.executeUpdate("update posts set orderby="+(maxorderby+1)+" where db="+db+" and groupid="+topic);
        if(postok) {
          righttitle="提前帖子成功";
          rightinfo="您已经成功的把帖子提到最上面!";
        }
      }
    }
  }
  else {
    errortitle="提前帖子失败";
    errorinfo="这个操作必须由这个版的斑竹或副斑竹完成!";
  }
}
else if(action.equals("delete")) {
  if(isadmin>0 || isauthor) {
    if(submit.equals("")) {
%>
      <form action="postings.jsp" method=post name=delposts>
       <input type=hidden name="action" value="<%=action%>">
       <input type=hidden name="topic" value="<%=topic%>">
       <input type=hidden name="db" value="<%=db%>">
       <input type=hidden name="request" value="提 交">
      </form>
      <script>
       delposts("<%=topic%>");
      </script>
<%
      errortitle="删除帖子失败";
      errorinfo="您已经取消了删除帖子的操作!";
    }
    else if(submit.equals("提 交")){
      int postparentauthorid=0;
      String postparentauthor="";
      rs=connect.executeQuery("select authorid,author,id,vote from posts where db="+db+" and groupid="+topic+" and parentid=0");
      if(rs.next()) {
        postparentauthorid=rs.getInt(1);
        postparentauthor=rs.getString(2);
        postdeleteid=rs.getInt(3);
        postvote=rs.getString(4);
      }
      if(postparentauthorid!=0) {
        //减去用户货币值
        int delmoney=0,delexperience=0,delcharm=0,authormoney=0,authorexperience=0,authorcharm=0;
        rs=connect.executeQuery("select delmoney,delexperience,delcharm from encourage where id=1");
        if(rs.next()) {
          delmoney=rs.getInt(1);
          delexperience=rs.getInt(2);
          delcharm=rs.getInt(3);
          rs=connect.executeQuery("select money,experience,charm from author where id="+postparentauthorid);
          if(rs.next()) {
            authormoney=rs.getInt(1);
            authorexperience=rs.getInt(2);
            authorcharm=rs.getInt(3);
            if(authormoney<delmoney) delmoney=0;
            else delmoney=authormoney-delmoney;
            if(authorexperience<delexperience) delexperience=0;
            else delexperience=authorexperience-delexperience;
            if(authorcharm<delcharm) delcharm=0;
            else delcharm=authorcharm-delcharm;
            connect.executeUpdate("update author set money="+delmoney+",experience="+delexperience+",charm="+delcharm+",ndelete=ndelete+1 where id="+postparentauthorid);
          }
        }
      }
      postok=connect.executeUpdate("delete from posts where db="+db+" and groupid="+topic);
      if(postvote.equals("1")) {
        connect.executeUpdate("delete from vote where postsid="+postdeleteid);
        connect.executeUpdate("delete from voterecord where postsid="+postdeleteid);
      }
      if(postok) {
        righttitle="删除帖子成功";
        rightinfo="您已经成功的删除您选择的帖子及所有属于这个帖子的回复帖!";
      }
    }
  }
  else {
    errortitle="删除帖子失败";
    errorinfo="这个操作必须由这个版的斑竹或副斑竹或发帖人完成!";
  }
}
else if(action.equals("directdel")) {
  rs=connect.executeQuery("select parentid from posts where id="+postid);
  if(rs.next())
    postparentid=rs.getInt(1);
  if(postid==0)
    response.sendRedirect("errorPage.jsp");
  else if((isadmin>0 || (isauthor && arrowuserdel.equals("1"))) && postparentid!=0) {
    if(submit.equals("")) {
%>

⌨️ 快捷键说明

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