📄 pcmain.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="con" scope="page" class="numb1.com.db"/>
<jsp:useBean id="ht" scope="page" class="numb1.com.Dohtml"/>
<jsp:useBean id="onLine" scope="application" class="numb1.com.onLine"/>
<%@ include file = "include/config.jsp" %>
<%
String id=(String)session.getAttribute("id");id=ht.donull(id);
String root=(String)session.getAttribute("root");root=ht.donull(root);
String name=(String)session.getAttribute("name");name=ht.donull(name);
String bdid=request.getParameter("id");
String stringpage=request.getParameter("page");//stringpage为未处理的字符串型的页码数
String table="";
String bdname="";
String logo="";
String information="";
String focus="";
String main="main.jsp";
String display="display.jsp";
String reer="";
String sql;
int retimes,readtimes;
int x=0;//计数器
int count=0;
int showrow=36;//每页显示条数
int pages=1;//当前页数
int startrow; //本页开始条数
int allcount=0;
//本页文件名
String f_name=request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/")+1,request.getRequestURI().lastIndexOf("."));
if(root.compareTo("")==0){root="0";}
int step=Integer.parseInt(root);
pages=ht.getInteger(stringpage,1);
if(!ht.isNumber(bdid)){
out.print("<meta http-equiv=\"refresh\" content=\"1;URL=first.jsp\"><center><font color=#FF0000><strong>参数错误</strong></font></center>");
}else{
sql = "SELECT btable, name, logo, inform, focus, page FROM board WHERE id="+bdid;
ResultSet board=con.query(sql);board.next();
if(board.getRow()==0){
out.print("<meta http-equiv=\"refresh\" content=\"1;URL=index.jsp\"><center><font color=#FF0000><strong>该版不存在,参数错误或该版以被删除</strong></font></center>");
}else{
table=board.getString(1);
bdname=con.getStr(board.getString(2));
logo=con.getStr(board.getString(3));
information=con.getStr(board.getString(4));
focus=con.getStr(board.getString(5));
main=board.getString(6)+main;
display=board.getString(6)+display;
java.io.File f1=new java.io.File(absDir+relDir+main);
java.io.File f2=new java.io.File(absDir+relDir+display);
if(!f1.isFile()){main="main.jsp";}
if(!f2.isFile()){display="display.jsp";}
//验证页面
if((main.compareTo(_self)!=0)){
response.sendRedirect(main+"?id="+bdid);
}else{
//计算本版总贴数
if(table.compareTo("")==0){table="btable1";}
sql="SELECT COUNT(id) FROM "+table+" WHERE boardid="+bdid;
ResultSet bcount=con.query(sql);bcount.next();
if(bcount.getRow()!=0){
allcount=bcount.getInt(1);
}
//计算页数
sql="SELECT id, title, clas, super, recommendation, locked, userid, username, lastid, lastname, readtimes, retimes, lastretime FROM "+table+" WHERE boardid="+bdid+" AND up='n' ORDER BY lastretime DESC" ;
ResultSet rs=con.query(sql);
rs.last();
count=rs.getRow();
int pcount=count/showrow;
if(count%showrow>0){pcount=pcount+1;}
if(pcount<2)pcount=1;
if(pages<2)pages=1;
if(pages>pcount)pages=pcount;
startrow=(pages-1)*showrow+1;
if(online_enable == "on"){
String uId,uName,ip=request.getRemoteAddr();
if(id.compareTo("")==0){
uId="guest";
uName="guest";
}else{
uId=id;
uName=name;
}
onLine.addUser(uId,uName,(_self+"?id="+bdid),ip,onTime);
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=bdname%>BBS</title>
<style type="text/css">
<!--
p{text-indent:18pt;font-size:13px}
td{font-size:13px}
a:link{text-decoration:none;color:#0000ff}
a:visited{text-decoration:none;color:#0000ff}
a:hover{text-decoration:underline;color:#96CCFE}
.style5 {color: #FFFFFF; font-size: 13px; }
.link {color:#585858}
.link a:link{text-decoration:none;color:#868686}
.link a:visited{text-decoration:none;color:#868686}
.link a:hover{text-decoration:underline;color:#868686}
.tims0 {color: #0000FF}
.tims1 {color: #FF0000}
.tims2 {color: #FF0000;font-weight:bold;}
.tims3 {color: #FF0000;font-weight:bold;Filter:glow(color=#ffff00,strength=1);WIDTH:45px}
body {
margin-top: 2px;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" align="center" bgcolor="#f1f1f1">
<tr>
<td bgcolor="#fafafa"><div align="right" style="font-size:12px "> [<a href="first.jsp">论坛首页</a>]
<% out.print("[<font color=\"#FF0000\">"+bdname+"</font>]");if(id.compareTo("")==0){%> [<a href="login.jsp?page=<%=f_name%>&bdid=<%=bdid%>">登录</a>] [<a href="reg.jsp">注册</a>]
<%}else{%> [<a href="shutdown.jsp">离开</a>]
<% }%>
</div></td>
</tr>
<tr>
<td height="36" bgcolor="#fafafa"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" bgcolor="#aaaaaa">
<tr bgcolor="#f8f8f8">
<td width="7%"><img src="<%=logo%>" alt="<%=bdname%>版logo"></td>
<td width="93%" bgcolor="#f8f8f8"><table width="98%" border="0" align="center" cellspacing="0">
<tr>
<td colspan="2">
<table width="100%" border="0" align="center" cellspacing="0">
<tr>
<td width="23%"> </td>
<td height="20" bgcolor="#f0f0f0" class="link"> <font color="#0000FF"><img src="img/mast.gif" width="18" height="11"> 斑竹:</font>
<%
sql = "SELECT userid, username FROM master WHERE bid="+bdid;
ResultSet master=con.query(sql);
while(master.next()){
out.print(" <a href=aboutuser.jsp?id="+master.getString(1)+" target=_blank>"+con.getStr(master.getString(2))+"</a> ");
if(master.getString(1).compareTo(id) == 0) step = 3;
}
%></td>
</tr>
</table></td>
</tr>
<tr>
<td height="8" colspan="2"></td>
</tr>
<tr bgcolor="#638ACE">
<td height="1" colspan="2"></td>
</tr>
<tr>
<td height="8" colspan="2"></td>
</tr>
<tr>
<td width="15%"><div align="right"><strong>公 告:</strong></div></td>
<td><marquee onMouseOver="this.stop()" onMouseOut="this.start()" scrollamount="3" width="88%">
<%=information%>
</marquee></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" align="center">
<tr>
<td colspan="2"><table width="100%" border="0" cellspacing="0">
<tr>
<td height="10"></td>
</tr>
<tr>
<td>
</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="22%"><% if(online_enable.compareTo("on") == 0){ int counter=onLine.gThisCount(bdid);%> 在线人数:<a <% if(root.compareTo("")!=0){ out.print("href=online.jsp");}%> target="_blank"><span class="<% if(counter >= 50){out.print("tims3");}else if(counter >= 10){out.print("tims2");}else if(counter >= 5){out.print("tims1");}else{out.print("tims0");}%>"><%=counter+"人"%></span></a><% }%></td>
<td width="78%"><div align="right"><% if(count>1){ if(pages>1){%><a
href="<%=_self%>?id=<%=bdid%>">首</a> <a
href="<%=_self%>?id=<%=bdid%>&page=<%=(pages-1)%>">上一页</a><% }
if(pages<pcount){%> <a href="<%=_self%>?id=<%=bdid%>&page=<%=(pages+1)%>">下一页</a> <a
href="<%=_self%>?id=<%=bdid%>&page=<%=pcount%>">尾页</a><% }} if(id.compareTo("")!=0){%>
<a href="send.jsp?id=<%=bdid%>"> 发贴</a>
<% }%>
第<%=pages%>页 共<%=pcount%>页 共<%=allcount%>贴 <% if(step>2){%><a href="boardset.jsp?bdid=<%=bdid%>">版管理</a>
<% } if(step>3){%> <a href="admin/adminmast.jsp?bdid=<%=bdid%>">斑竹管理</a>
<%}%> </div></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" style="BORDER-BOTTOM: #d1d1df 1px solid; BORDER-LEFT: #d1d1df 1px solid; BORDER-RIGHT: #d1d1df 1px solid; BORDER-TOP: #d1d1df 1px solid">
<tr bgcolor="#7188e0">
<th width="7%"><span class="style5">回复
</span></th>
<th width="7%"><span class="style5">阅读
</span></th>
<th width="42%" height="20"><span class="style5">主题</span></th>
<th width="13%"><span class="style5">作者
</span></th>
<th width="19%"><span class="style5">回复时间
</span></th>
<th><span class="style5">最后回复</span></th>
</tr>
<%
if(pages==1){
String sqlup="SELECT id, title, clas, super, recommendation, locked, userid, username, lastid, lastname, readtimes, retimes, lastretime FROM "+table+" WHERE boardid="+bdid+" AND up='y' ORDER BY lastretime DESC";
ResultSet rsup=con.query(sqlup);
while(rsup.next()){
if(rsup.getString(9).compareTo("")!=0){reer="<a href=aboutuser.jsp?id="+rsup.getString(9)+" target=_blank>"+con.getStr(rsup.getString(10))+"</a>";}
else{reer="--";}
retimes=rsup.getInt(12);
readtimes=rsup.getInt(11);
%>
<tr bgcolor="#f8f8f8">
<td height="10" class="link"><div align="center" class="<% if(retimes >= 100){out.print("tims3");}else if(retimes >= 50){out.print("tims2");}else if(retimes >= 5){out.print("tims1");}%>"><%=rsup.getString(12)%></div></td>
<td class="link"><div align="center" class="<% if(retimes >= 1000){out.print("tims3");}else if(readtimes >= 100){out.print("tims2");}else if(readtimes >= 10){out.print("tims1");}%>"><%=rsup.getString(11)%></div></td>
<td class="link"> <a href="<%=display%>?bdid=<%=bdid%>&bbsid=<%=rsup.getString(1)%>" <% if("on".equals(windowopen)){out.print("target=\"_blank\"");}%>><%=con.getStr(rsup.getString(2))%></a><img src=img/up.gif alt=置顶文章><% if("y".equals(rsup.getString(4))){out.print("<img src=img/super.gif alt=精华文章>");} if("y".equals(rsup.getString(5))){out.print("<img src=img/recom.gif alt=推荐文章>");} if("y".equals(rsup.getString(6))){out.print("<img src=img/lock.gif alt=锁定文章>");}%></td>
<td class="link"><div align="center"><a href="aboutuser.jsp?id=<%=rsup.getString(7)%>" target="_blank"><%=con.getStr(rsup.getString(8))%></a></div></td>
<td class="link"><div align="center"><%=rsup.getString(13).substring(5,16)%></div></td>
<td class="link"><div align="center"><%=reer%></div></td>
</tr><% }
}
rs.absolute(startrow);
rs.previous();
while(rs.next()){
if(rs.getString(9).compareTo("")!=0){
reer="<a href=aboutuser.jsp?id="+rs.getString(9)+" target=_blank>"+con.getStr(rs.getString(10))+"</a>";
}else{reer="--";}
retimes=rs.getInt(12);
readtimes=rs.getInt(11);
%>
<tr bgcolor="#f8f8f8">
<td height="10" class="link"><div align="center" class="<% if(retimes >= 100){out.print("tims3");}else if(retimes >= 50){out.print("tims2");}else if(retimes >= 5){out.print("tims1");}%>"><%=rs.getString(12)%></div></td>
<td class="link"><div align="center" class="<% if(retimes >= 1000){out.print("tims3");}else if(readtimes >= 100){out.print("tims2");}else if(readtimes >= 10){out.print("tims1");}%>"><%=rs.getString(11)%></div></td>
<td class="link"> <a href="<%=display%>?bdid=<%=bdid%>&bbsid=<%=rs.getString(1)%>" <% if("on".equals(windowopen)){out.print("target=\"_blank\"");}%>><%=con.getStr(rs.getString(2))%></a><% if("y".equals(rs.getString(4))){out.print("<img src=img/super.gif alt=精华文章>");} if("y".equals(rs.getString(5))){out.print("<img src=img/recom.gif alt=推荐文章>");} if("y".equals(rs.getString(6))){out.print("<img src=img/lock.gif alt=锁定文章>");}%></td>
<td class="link"><div align="center"><a href="aboutuser.jsp?id=<%=rs.getString(7)%>" target="_blank"><%=con.getStr(rs.getString(8))%></a></div></td>
<td class="link"><div align="center"><%=rs.getString(13).substring(5,16)%></div></td>
<td class="link"><div align="center"><%=reer%></div></td>
</tr><% x++;if(x==showrow)break;}%>
<tr bgcolor="#9DACEA">
<th><span class="style5">回复</span></th>
<th><span class="style5">阅读</span></th>
<th height="20"><span class="style5">主题</span></th>
<th><span class="style5">作者</span></th>
<th><span class="style5">回复时间</span></th>
<th><span class="style5">最后回复</span></th>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td> </td>
</tr>
<tr>
<td height="20" bgcolor="#f0f0f0"> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
<%
}
}
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -