📄 bbsaddre.jsp
字号:
<%@ page contentType="text/html;charset=gb2312" %>
<%@ include file="incdb.jsp"%>
<jsp:useBean id="user" class="test.bbsuser" scope="page"/>
<jsp:useBean id="bbs" class="test.bbs" scope="page"/>
<jsp:useBean id="board" class="test.bbsboard" scope="page"/>
<%
int boardid,bbsid,parentid,child,bbshits,length;
String username,useremail,userip,expression,usersign,bbstopic,bbscontent,dateandtime,userpassword;
String boardname;
String tt,strSQL,tempSTR,whereTo;
byte[] tmpbyte;
java.sql.ResultSet sqlRst; //'ADODB RECORDSE 对象
tempSTR=request.getParameter("boardid");
boardid=java.lang.Integer.parseInt(tempSTR);
tempSTR=request.getParameter("bbsid");
bbsid=java.lang.Integer.parseInt(tempSTR);
tt=request.getParameter("tt");
if (tt==null){
tt="";
}
%>
<%
String B1=request.getParameter("B1");
if (B1!=null){
//开始加贴操作
tempSTR=request.getParameter("bbsid");
parentid=java.lang.Integer.parseInt(tempSTR);
child=0;
username=request.getParameter("username");
username=username.trim();
tmpbyte=username.getBytes("ISO8859_1");
username=new String(tmpbyte);
userpassword=request.getParameter("userpassword");
userpassword=userpassword.trim();
userip="127.0.0.1";
expression=request.getParameter("expression");
bbstopic=request.getParameter("bbstopic");
bbstopic=bbstopic.trim();
tmpbyte=bbstopic.getBytes("ISO8859_1");
bbstopic=new String(tmpbyte);
bbscontent=request.getParameter("bbscontent");
tmpbyte=bbscontent.getBytes("ISO8859_1");
bbscontent=new String(tmpbyte);
//dateandtime="";
bbshits=0;
length=bbscontent.length();
//'========================================================================
if ((username==null)||(userpassword==null)||(bbstopic==null)) {
tt="内容没有填全 请重新填写";
%>
<script language="JavaScript">
window.location="bbsaddre.jsp?boardid="+boardid+"&tt="+tt+"&bbsid"+bbsid;
</script>
<%}
//end if ((username==null)||(userpassword==null)||(bbstopic==null))
//'==========================================================================
if (!user.checkUserPassword(username,userpassword)) {
tt="密码错误或用户不存在,请重新填写 ";
%>
<script language="JavaScript">
window.location="bbslist.jsp?boardid="+boardid+"&tt="+tt;
</script>
<%
}else{
useremail=user.getUserEmail();
usersign=user.getUserSign();
bbs.setBbsParentid(parentid);
bbs.setBbsBoardid(boardid);
bbs.setBbsChild(child);
bbs.setBbsUsername(username);
bbs.setBbsUseremail(useremail);
bbs.setBbsUserip(userip);
bbs.setBbsExpression(expression);
bbs.setBbsUsersign(usersign);
bbs.setBbsTopic(bbstopic);
bbs.setBbsContent(bbscontent);
bbs.setBbsHits(bbshits);
bbs.setBbsLength(length);
bbs.addNewBbs();
user.changeUserClass(username,1); //'读出用户信息并给用户加分:1分
bbs.changeBbsChild (parentid,1); //'BBS主贴回复数加1
%>
<%whereTo="bbslist.jsp?boardid="+boardid;%>
<jsp:forward page='<%=whereTo%>'/>
<%
}//end else
}//if (B1!=null)
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>加贴</title>
<link rel="stylesheet" type="text/css" href="bbs03.css">
</head>
<body>
<script Language="JavaScript">
<!--
function isspacestring(mystring)
//是否为空格字符串;true为空,FALSE为非空
{ var istring=mystring;
var temp,i,strlen;
temp=true;
strlen=istring.length;
for (i=0;i<strlen;i++)
{
if ((istring.substring(i,i+1)!=" ")&(temp))
{ temp=false; }
}
return temp;
}
function firstisspace(mystring)
//检查首字母是否是空格,TRUE首字母为空格;FALSE首字母不为空格
{ var istring=mystring;
var temp,i;
temp=true;
if (istring.substring(0,1)!=" ")
{ temp=false; }
return temp;
}
function isemail(mystring)
{
var istring=mystring;
var atpos=mystring.indexOf("@");
var temp=true;
if (atpos==-1) //email中没有@符号;不正确的EMAIL
{
temp=false;
}
return temp;
}
function check_input(theForm)
{
if ((theForm.username.value == "")|(isspacestring(theForm.username.value)))
{
alert("请输入正确的用户名.");
theForm.username.focus();
return (false);
}
if ((theForm.userpassword.value == "")|(isspacestring(theForm.userpassword.value)))
{
alert("请输入密码.");
theForm.userpassword.focus();
return (false);
}
if ((theForm.bbstopic.value == "")|(isspacestring(theForm.bbstopic.value)))
{
alert("您没写主题.");
theForm.bbstopic.focus();
return (false);
}
return (true);
}
//-->
</script>
<!--首次进入本页-->
<%
boardname="";
parentid=0;
username="";
bbstopic="";
dateandtime="";
bbscontent="";
usersign="";
if (board.getBoardInfo(boardid)){
boardname=board.getBoardName();
}
bbs.changeBbsHits (bbsid,1); //'BBS点击数加1
if (bbs.getBbsInfo(bbsid)){
parentid=bbs.getBbsParentid();
username=bbs.getBbsUsername();
bbstopic=bbs.getBbsTopic();
dateandtime="";
bbscontent=bbs.getBbsContent();
usersign=bbs.getBbsUsersign();
}
%>
<!-------------主贴----------------->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<p align="center"><b><%=bbstopic%></b></p>
<hr color="#000080" size="1">
<p><%=username%> 于<%=dateandtime%> 发表于:<b><%=boardname%></b></p>
<p><%=bbscontent%></p>
<p align="left"><font color="#000080"><%=usersign%></font></p>
<hr color="#000080">
</td>
</tr>
</table>
<!--------------所有跟贴---------------->
<%
sqlRst=bbs.listBbsRe (bbsid);
while(sqlRst.next()){
username=sqlRst.getString("username");
bbstopic=sqlRst.getString("bbstopic");
dateandtime=sqlRst.getString("dateandtime");
bbscontent=sqlRst.getString("bbscontent");
usersign=sqlRst.getString("usersign");
if (bbscontent==null){
bbscontent="";
}
if (usersign==null){
usersign="";
}
//}
%>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<p><%=username%> 于<%=dateandtime%> 发表于:<b><%=boardname%></b></p>
<p><b><%=bbstopic%></b></p>
<p><%=bbscontent%></p>
<p align="left"><font color="#000080"><%=usersign%></font></p>
<hr color="#000080" size="1">
</td>
</tr>
</table>
<%}
sqlRst.close();
%>
<div align="center">
<center>
<table border="0" width="100%">
<tr>
<td width="100%">
<p align="center"><%=tt%></p>
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="1" width="500" bordercolorlight="#000000" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF">
<tr>
<td width="100%" bgcolor="#000080">
<p align="center"><font color="#FFFFFF">我 要 回 复</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF" valign="top">
<div align="center">
<center>
<table border="0" width="440">
<tr>
<td width="100%" valign="top">
<form method="POST" action="bbsaddre.jsp" onsubmit="return check_input(this)" name="bbs_add_form">
<p style="margin-top: 0; margin-bottom: 0"><b><font color="#008000">版面:</font></b><a href="bbslist.jsp?boardid=<%=boardid%>"><%=boardname%></a></p>
<p align="left" style="margin-top: 0; margin-bottom: 0"><font color="#008000"><b>姓名</b></font><font color="#008000"><b>:</b></font><input type="text" name="username" size="20">
<b><font color="#008000"> 密码:</font></b><input type="password" name="userpassword" size="10">
<a href="registry.jsp" target="_self">用户注册</a></p>
<p align="left" style="margin-top: 0; margin-bottom: 0"><b><font color="#008000">主题:</font></b><input type="text" name="bbstopic" size="50"></p>
<p align="left" style="margin-top: 0; margin-bottom: 0"><font color="#008000"><b>表情:</b></font><input type="radio" value="001.gif" name="expression" checked><img border="0" src="images/001.gif"><input type="radio" value="002.gif" name="expression"><img border="0" src="images/002.gif"><input type="radio" value="003.gif" name="expression"><img border="0" src="images/003.gif" width="20" height="20"><input type="radio" value="004.gif" name="expression"><img border="0" src="images/004.gif" ><input type="radio" value="005.gif" name="expression"><img border="0" src="images/005.gif" ><input type="radio" value="006.gif" name="expression"><img border="0" src="images/006.gif" ><input type="radio" value="007.gif" name="expression"><img border="0" src="images/007.gif" ><input type="radio" value="008.gif" name="expression"><img border="0" src="images/008.gif" ><input type="radio" value="009.gif" name="expression"><img border="0" src="images/009.gif" ></p>
<p align="left" style="margin-top: 0; margin-bottom: 0">
<input type="radio" value="010.gif" name="expression"><img border="0" src="images/010.gif" ><input type="radio" value="011.gif" name="expression"><img border="0" src="images/011.gif" ><input type="radio" value="012.gif" name="expression"><img border="0" src="images/012.gif" ><input type="radio" value="013.gif" name="expression"><img border="0" src="images/013.gif" ><input type="radio" value="014.gif" name="expression"><img border="0" src="images/014.gif" ></p>
<p align="left" style="margin-top: 0; margin-bottom: 0"><b><font color="#008000">内容:</font></b><b><font color="#008000">
</font></b><input class="buttonface" type="submit" value=" 发 表 " name="B1">
<input class="buttonface" type="reset" value=" 取 消 " name="B2"></p>
<p align="left" style="margin-top: 0; margin-bottom: 0">
<textarea rows="4" name="bbscontent" cols="50"></textarea>
</p>
<input type="hidden" name="bbsid" value="<%=bbsid%>">
<input type="hidden" name="boardid" value="<%=boardid%>"><input type="hidden" name="parentid" value="<%=parentid%>">
</form>
</td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -