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

📄 poll.jsp

📁 这是一个用JSP开发的论坛源 码。。。 按照上在的README可轻松的捅有下JSP论坛
💻 JSP
字号:
<%
/*##################################################################**
**#  程序名称:LyBBS『凌云论坛』                                   #**
**#                                                                #**
**#  程序开发: teddy 『星语凌』                                    #**
**#                                                                #**
**#  版权所有: 凌云创作室 (原流星电脑工作室)                       #**
**#                                                                #**
**#  主页地址: http://www.lybbs.net                                #**
**#  电邮地件: horseye@sina.com                                    #**
**#                                                                #**
**##################################################################*/
%>
<%@ include file="include/config.jsp"%>
<%@ page contentType="text/html;charset=GBK" %>
<jsp:useBean id="smartUpload" scope="page" class="com.lyforum.upload.SmartUpload" />
<%
int forumID=0,
    postID=0,
    topic=0;
String action="",
       tempSTR="";
//取传递变量
smartUpload.initialize(pageContext);
smartUpload.upload();

ParameterUtils.setCharacterEncoding(request);

forumID=ParameterUtils.getInt(request,"forumID");
topic=ParameterUtils.getInt(request,"topic");
postID=ParameterUtils.getInt(request,"postID");
action=ParameterUtils.getString(request,"action");

if(action.equals("") || forumID==0)
  response.sendRedirect("errorPage.jsp");
%>
<%@ include file="include/boardprepare.jsp"%>

<!--//html from here-->
<%@ include file="include/head.jsp"%>
<body <%=lbbody%>>
<%@ include file="include/userheader.jsp"%>
<p>
<%
Forum forum=(new ForumFactory()).getForum(forumID);
String forumName=forum.getForumName(),
       htmlStat=forum.getHtmlStat(),
       lyCodeStat=forum.getLyCodeStat(),
       startNewThreads=forum.getStartNewThreads(),
       privateForum=forum.getPrivateForum();

String arrawPostFontSize=forumStyle.getArrawPostFontSize(),//是否允许改变字体大小
       arrawPostPic=forumStyle.getArrawPostPic(),//是否允许贴图
       advPost="0";//简单/高级模式

forumStatus.getPostConfig();
int floodControlLimit=forumStatus.getFloodControlLimit();
String floodControl=forumStatus.getFloodControl(),
       emotIcons=forumStatus.getEmotIcons();

ForumPost forumPost=new ForumPost();
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> align=center>
 <tr>
  <td width=30% rowspan=2 valign=top>
   <img src="images/<%=boardlogo%>" border=0>
  </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="forum.jsp?forumID=<%=forumID%>"><%=forumName%></a><br>
     &nbsp;&nbsp;&nbsp;<img src="images/bar.gif" border=0><img src="images/openfold.gif" border=0> 发起新投票
     </font>
  </td>
 </tr>
</table>
<script language="JavaScript">
function HighlightAll(theField) {
  var tempval=eval("document."+theField)
  tempval.focus()
  tempval.select()
  therange=tempval.createTextRange()
  therange.execCommand("Copy")
}
function DoTitle(addTitle) {
  var revisedTitle;
  var currentTitle = document.submitok.postTitle.value;
  revisedTitle = currentTitle+addTitle;
  document.submitok.postTitle.value=revisedTitle;
  document.submitok.postTitle.focus();
  return;
}
</script>
<%
if(action.equals("new")) {
  tempSTR=ParameterUtils.getString(request,"advPost");
  if(!tempSTR.equals(""))
    advPost=tempSTR;
  else {
    if(cookieMode.equals("0"))
      advPost=forumStyle.getAdvPost();
    else
      advPost=user.getAdvPost();
  }
%>
<%@ include file="include/polltable.jsp"%>
<%
}
else if(action.equals("addnew")) {
  if(!cookieMode.equals("0")) {
    forumPost.setFloodControlLimit(floodControlLimit);
    forumPost.setFloodControl(floodControl);
    forumPost.setCookieID(cookieID);
    forumPost.setCookieName(cookieName);
    forumPost.setCookieMode(cookieMode);
  }
  forumPost.setForumID(forumID);
  forumPost.setStartNewThreads(startNewThreads);
  forumPost.setPrivateForum(privateForum);
  forumPost.setPostIP(request.getRemoteAddr());
  forumPost.setCheckPass(user.getAllowPrivate(forumID));
  forumPost.setAction(action);

  forumPost.addNewPoll(request,response,smartUpload);
  String errorInfo=forumPost.getErrorInfo();
  int maxOrderBy=forumPost.getOrderBy();
  if(cookieMode.equals("0")) {
    cookieMode=forumPost.getCookieMode();
    cookieName=forumPost.getCookieName();
  }
%>
<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(errorInfo.equals("")) {
    if(cookieMode.equals("0"))
      out.println("谢谢,访客!您的新投票已经发表成功!");
    else
      out.println("谢谢,"+cookieName+"!您的新投票已经发表成功!");
  }
  else {
    out.println("错误: 发表新投票!");
  }
%>
      </b></font>
     </td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>>
      <font color=<%=fontcolormisc%>>
<%
  if(errorInfo.equals("")) {
%>
        如果浏览器没有自动返回,请点击下面的链接!
        <ul>
         <li><a href="topic.jsp?forumID=<%=forumID%>&topic=<%=maxOrderBy%>">返回新投票</a>
         <li><a href="forum.jsp?forumID=<%=forumID%>">返回论坛</a>
         <li><a href="index.jsp">返回论坛首页</a>
        </ul>
        <meta http-equiv="refresh" content="3; url=topic.jsp?forumID=<%=forumID%>&topic=<%=maxOrderBy%>">
<%
  }
  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>
<%
}
else if(action.equals("poll")) {
  if(postID==0 || topic==0)
     response.sendRedirect("errorPage.jsp");
  if(!cookieMode.equals("0")) {
    forumPost.setCookieID(cookieID);
    forumPost.setCookieName(cookieName);
    forumPost.setCookieMode(cookieMode);
  }
  int myChoice=0;
  tempSTR=smartUpload.getRequest().getParameter("myChoice");
  if(tempSTR!=null && !tempSTR.equals(""))
    myChoice=Integer.parseInt(tempSTR);
  forumPost.setForumID(forumID);
  forumPost.setTopic(topic);
  forumPost.setPostID(postID);
  forumPost.setStartNewThreads(startNewThreads);
  forumPost.setPrivateForum(privateForum);
  forumPost.setMyChoice(myChoice);
  forumPost.setCheckPass(user.getAllowPrivate(forumID));
  forumPost.setPoll();
  String errorInfo=forumPost.getErrorInfo();
%>
<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(errorInfo.equals("")) out.println("谢谢!您参与投票成功!");else out.println("对不起!您参与投票失败!");%></b></font>
     </td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>>
      <font color=<%=fontcolormisc%>>
<%
  if(errorInfo.equals("")) {
%>
      如果浏览器没有自动返回,请点击下面的链接!
      <ul>
       <li><a href="topic.jsp?forumID=<%=forumID%>&topic=<%=topic%>">返回此投票贴</a>
       <li><a href="forum.jsp?forumID=<%=forumID%>">返回论坛</a>
       <li><a href="index.jsp">返回论坛首页</a>
      </ul>
      <meta http-equiv="refresh" content="3; url=topic.jsp?forumID=<%=forumID%>&topic=<%=topic%>">
<%
  }
  else {
%>
    关于投票错误的详细原因:
    <ul>
     <li><b><%=errorInfo%> </b>
     <li>您是否需要查看<a href="javascript:openScript('help.jsp',500,400)">帮助文件</a>?
    </ul>
<%
  }
%>
      </font>
     </td>
    </tr>
   </table>
  </td>
 </tr>
</table>
<%
}
%>
</body>
</html>

⌨️ 快捷键说明

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