JSP留言簿系统无版权 第7页
<tr>
<td align="center">个人主页:</td>
<td><input name="homepage" type="text" class="table" id="homepage" size="50" value="<%=rs.getString("homepage")%>"></td>
</tr>
<tr>
<td align="center">地址:</td>
<td><input name="address" type="text" class="table" id="address" size="50" value="<%=rs.getString("address")%>"></td>
</tr>
<tr>
<td align="center">邮政编码:</td>
<td><input name="postcode" type="text" class="table" id="postcode" value="<%=rs.getString("postcode")%>"></td>
</tr>
<tr>
<td align="center">Email:</td>
<td class="word"><input name="Email" type="text" class="table" id="Email" size="50" value="<%=rs.getString("email")%>">
*</td>
</tr>
<script language="javaScript">
function mycheck(){
if(form1.PWD1.value==""){
alert("请输入密码!");form1.PWD1.focus();return;}
if(form1.PWD2.value==""){
alert("请确认密码!");form1.PWD2.focus();return;}
if(form1.PWD1.value!=form1.PWD2.value){
alert("您两次输入的密码不一致,请重新输入!");
form1.PWD1.value="";form1.PWD2.value="";form1.PWD1.focus();return;}
if(form1.Email.value==""){
alert("请输入Email地址!");form1.Email.focus();return; }
form1.submit();
}
</script>
<tr>
<td colspan="2" align="center"><input type="button" name="save" value="保存" onclick="mycheck()">
<input type="reset" name="re" value="重置"></td>
</tr>
</table>
</form>
</td>
</tr>
</table></td>
</tr>
</table>
<%}%>
</body>
</html>
modify_deal.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<%
String username=(new String(request.getParameter("username").getBytes("iso-8859-1"),"gb2312"));
String PWD=(new String(request.getParameter("PWD1").getBytes("iso-8859-1"),"gb2312"));
String birthday=request.getParameter("birthday"); String sex=(new String(request.getParameter("sex").getBytes("iso-8859-1"),"gb2312"));
String OICQ=(new String(request.getParameter("OICQ").getBytes("iso-8859-1"),"gb2312"));
String tel=(new String(request.getParameter("tel").getBytes("iso-8859-1"),"gb2312"));
String homepage=(new String(request.getParameter("homepage").getBytes("iso-8859-1"),"gb2312"));
String address=(new String(request.getParameter("address").getBytes("iso-8859-1"),"gb2312"));
String postcode=request.getParameter("postcode");
String Email=(new String(request.getParameter("Email").getBytes("iso-8859-1"),"gb2312"));
int ret=0;
String sql="update tb_User set PWD='"+PWD+"',Birthday='"+birthday+"',Sex='"+sex+"',OICQ='"+OICQ+"',Tel='"+tel+"',homepage='"+homepage+"',address='"+address+"',postcode='"+postcode+"',Email='"+Email+"' where UserName='"+username+"'";
ret=connBean.executeUpdate(sql);
if(ret!=0){
out.println("<script language='javascript'>alert('资料修改成功!');window.location.href='index.jsp';</script>");
}else{
out.println("<script language='javascript'>alert('资料修改失败!');window.location.href='modify.jsp';</script>");
}
%>
reply.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<%
String TopicContent="";
ResultSet rs=connBean.executeQuery("select * from tb_User where UserName='"+session.getAttribute("username")+"' ");
if(!rs.next()){
out.println("<script language='javascript'>alert('对不起!您现在没有回复的权限,请您先登录');window.location.href='index.jsp';</script>");
}
else
{int TopicID=Integer.parseInt(request.getParameter("TopicID"));
ResultSet rs_T=connBean.executeQuery("Select * from tb_Topic where ID="+TopicID);
if(rs_T.next()){
TopicContent=rs_T.getString("content");
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/style.css" rel="stylesheet">
<title>蓝天一色留言簿</title>
</head>
<body onLoad="clockon()">
<jsp:include page="top.jsp"/>
<table width="777" height="197" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="53%" height="5" valign="top"></td>
</tr>
<tr>
<td valign="top"><table width="100%" height="171" border="0" cellpadding="0" cellspacing="0" class="table">
<tr>
<td width="2%" height="26" background="images/bg_banner.GIF"> </td>
<td width="98%" background="images/bg_banner.GIF" class="word">≡回复留言≡</td>
</tr>
<tr valign="top">
<td colspan="2">
<table width="100%" height="230" border="0" cellpadding="0" cellspacing="0" class="table_B">
<tr align="center">
<td width="23" rowspan="2" align="left"> </td>
<td width="182" rowspan="2" align="left"><%=rs.getString("UserName")%><p>
<%=rs.getString("sex")%>生
<p><img src="images/atusers.gif" alt="OICQ号码:<%=rs.getString("OICQ")%>" width="14" height="16">OICQ:<%=rs.getString("OICQ")%><br>
<br><img src="images/home-menu.gif" alt="个人主页:<%=rs.getString("homepage")%>" width="26" height="20">个人主页:<%=rs.getString("homepage")%><br>
<br>IP地址:
<p><img src="images/email.GIF" alt="Email:<%=rs.getString("email")%>" width="16" height="16">Email:<%=rs.getString("email")%></td>
<td width="1" rowspan="2" align="center" valign="bottom" bgcolor="#07AFBE"></td>
<td align="left" valign="top" class="word" style="padding-left:
<table width="83%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="16%" height="10"> </td>
<td width="84%"> </td>
</tr>
<form name="form1" method="post" action="reply_deal.jsp">
<tr>
<td width="16%" height="80"><p>留言信息:</p>
</td>
<td width="84%"><%=TopicContent%></td>
</tr>
<tr>
<td height="156" valign="middle">回复留言:</td>
<td valign="top"><textarea name="content" cols="50" rows="11" id="content"></textarea></td>
</tr>
<tr align="center" valign="middle">
<td height="32" colspan="2"><input name="TopicID" type="hidden" id="TopicID" value="<%=TopicID%>">
<input name="Submit" type="submit" class="button" value="保存">
<input name="Submit" type="reset" class="button" value="重置"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<%}%>
<br>
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
reply_deal.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" class="beans.connDB" scope="page"/>
<%
String content1=request.getParameter("content");
String content=(new String(content1.getBytes("iso-8859-1"),"gb2312"));
int TopicID=Integer.parseInt(request.getParameter("TopicID"));
String replyuser=(session.getAttribute("username")).toString();
if(content!=null && content.length()>0){
String sql="Insert into tb_reply values("+TopicID+",'"+content+"','"+replyuser+"')";
int ret=0;
ret=connBean.executeUpdate(sql);
if(ret!=0){
out.println("<script language='javascript'>alert('回复信息成功!