JSP留言簿系统无版权 第6页
alert("您输入的版主名称不正确,请重新输入!");
history.back();
</script>
<%}
}%>
Logout_User.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
session.removeAttribute("username"); //清空Session变量
response.sendRedirect("index.jsp");
%>
Topic_add.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<%
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 UID=rs.getInt("ID");
%>
<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="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="12%" height="10"> </td>
<td width="88%"> </td>
</tr>
<form name="form1" method="post" action="Topic_add_deal.jsp">
<tr>
<td height="27" valign="middle">心情:</td>
<td valign="top"><select name="face" id="face">
<option value="微笑" selected>微笑</option>
<option value="伤心">伤心</option>
<option value="大笑">大笑</option>
<option value="忧郁">忧郁</option>
</select></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="UID" type="hidden" id="UID" value="<%=UID%>"> <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>
Topic_add_deal.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<%
int UID=0;
UID=Integer.parseInt(request.getParameter("UID"));
String face1=request.getParameter("face");
String face=(new String(face1.getBytes("iso-8859-1"),"gb2312"));
String content1=request.getParameter("content");
String content=(new String(content1.getBytes("iso-8859-1"),"gb2312"));
String sql="insert into tb_Topic (author,face,content) values("+UID+",'"+face+"','"+content+"')";
int ret=0;
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='Topic_add.jsp';</script>");
}
%>
modify.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<%
ResultSet rs=connBean.executeQuery("select * from tb_user where username='"+session.getAttribute("username")+"'");
if(!rs.next()){
response.sendRedirect("index.jsp");
}else{
%>
<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 align="center" valign="top">
<td colspan="2">
<form name="form1" method="post" action="modify_deal.jsp">
<table width="76%" height="295" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="22%"> </td>
<td width="78%"> </td>
</tr>
<tr>
<td align="center">用户名:</td>
<td><input name="username" type="text" class="table" id="username" value="<%=rs.getString("username")%>" readonly="yes">
*</td>
</tr>
<tr>
<td align="center">密码:</td>
<td class="word"><input name="PWD1" type="password" class="table" id="PWD1">
*</td>
</tr>
<tr>
<td align="center">确认密码:</td>
<td class="word"><input name="PWD2" type="password" class="table" id="PWD2">
*</td>
</tr>
<tr>
<td align="center">生日:</td>
<td class="word"><input name="birthday" type="text" class="table" id="birthday" value="<%=rs.getDate("birthday")%>">
(格式:
</tr>
<tr>
<td align="center">性别:</td>
<td><input name="sex" type="radio" value="男" <%if(rs.getString("sex").equals("男")){%>checked<%}%>>
男生
<input type="radio" name="sex" value="女" <%if(rs.getString("sex").equals("女")){%>checked<%}%>>
女生</td>
</tr>
<tr>
<td align="center">OICQ号码:</td>
<td><input name="OICQ" type="text" class="table" id="OICQ" value="<%=rs.getString("OICQ")%>"></td>
</tr>
<tr>
<td align="center">电话:</td>
<td><input name="tel" type="text" class="table" id="tel" value="<%=rs.getString("tel")%>"></td>
</tr>