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

📄 edit_vip.jsp

📁 用JSP写的一个在线购物网站的代码
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312" import="java.sql.*" %>
<jsp:useBean id="data" scope="page" class="shop.data.conn" />
<style type="text/css">
<!-- @import url(../images/css.css); -->
</style>
<%
String name=request.getParameter("name");
String admin=(String)session.getValue("admin");
String sql="select * from admin where admin='"+admin+"' and system='"+"1"+"'";
ResultSet rs=data.executeQuery(sql);
if(!rs.next())
{%>
<script language="javascript">
alert("对不起,您不是系统管理员不能进行相应操作");
history.back();
</script>
<%}else{
sql="select * from manager where name='"+name+"' and rate='"+"1"+"'";
rs=data.executeQuery(sql);
if(rs.next())
{
String pwd=rs.getString("pwd");
String pwdquery=rs.getString("pwdquery");
String pwdanswer=rs.getString("pwdanswer");
String sex=rs.getString("sex");
String realname=rs.getString("realname");
String email=rs.getString("email");
String address=rs.getString("address");
String tel=rs.getString("tel");
String brith=rs.getString("brith");
String IDcard=rs.getString("IDcard");
String zipcode=rs.getString("zipcode");
String rate=rs.getString("rate");
if(rate.equals("1"))
{ rate="VIP用户"; }
int whetherShop=rs.getInt("whetherShop");
int preordainShop=rs.getInt("preordainShop");
String regTime=rs.getString("regTime").substring(0,10);
String lastTime=rs.getString("lastTime").substring(0,16);
String mode=rs.getString("mode");
%><br>
<script language="JavaScript">
function check()
{
  if(document.update.newpwd.value.length!=0)
  {
     if(document.update.newpwd.value.length<6 || document.update.newpwd.value.length>10)
	 {
	     alert("请检查您新密码的位数是否在6和10之间");
		 document.update.newpwd.focus();
		 return false;
	 }
  }
  if(document.update.newpwd.value!=document.update.repwd.value)
  {
     alert("请检查您两次输入的新密码是否相同");
	 document.update.repwd.focus();
	 return false;
  }
}
</script>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <tr bgcolor="#CCCCCC"> 
    <td height="30" colspan="2" bgcolor="3969A5"></td>
  </tr>
  <form method="post" action="" name="update" onSubmit="return check()">
	<input type="hidden" name="updatethis" value="">
	<input type="hidden" name="name" value="<%=name%>">
    <tr bgcolor="#F2F2F2">
      <td colspan="2" height="430" bgcolor="#F2F2F2"> <table width="450" border="0" cellspacing="0" cellpadding="0" align="center">
          <tr> 
            <td height="40" colspan="2"><div align="center"><font color="#9C324D"><b>VIP用户<%=name%>的个人资料</b></font><br>
              </div></td>
          </tr>
          <tr> 
            <td height="25" width="150"> <div align="center">用户名称:</div></td>
            <td height="25" width="350"> <font color="#FF0000"><%=name%></font></td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">旧密码:</div></td>
            <td height="25" width="326"> <input type="password" name="pwd" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" size="15" maxlength="10" value="<%=pwd%>"></td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">新密码:</div></td>
            <td height="25" width="326"> <input type="password" name="newpwd" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" size="15" maxlength="10"> 
              <font color="#FF0000">  如果不想修改密码请保留为空</font></td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">重复新密码:</div></td>
            <td height="25" width="326"> <input type="password" name="repwd" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" size="15" maxlength="12"> 
            </td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">密码提示问题:</div></td>
            <td height="25" width="326"> <select name="pwdquery" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva">
                <option value='<%=pwdquery%>' selected><%=pwdquery%></option>
                <option value='您最喜欢的动物是什么?'>您最喜欢的动物是什么?</option>
                <option value='您最喜欢的运动是什么?'>您最喜欢的运动是什么?</option>
                <option value='您最喜欢看的书是什么?'>您最喜欢看的书是什么?</option>
                <option value='您最喜欢的人是谁?'>您最喜欢的人是谁?</option>
                <option value='您最爱说的话是什么?'>您最爱说的话是什么?</option>
                <option value='您家里共有几口人?'>您家里共有几口人?</option>
              </select></td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">密码提示答案:</div></td>
            <td height="25" width="326"> <input name="pwdanswer" type="text" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="<%=pwdanswer%>" size="20" maxlength="10"> 
            </td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">性别;</div></td>
            <td height="25" width="326"> 
			 <%if(sex.equals("先生")){%> <input type="radio" name="sex" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="先生" checked>先生 
              <input type="radio" name="sex" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="女士">女士 
              <input type="radio" name="sex" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="保密">保密 
            <%}%> 
			<%if(sex.equals("女士")){%> <input type="radio" name="sex" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="先生">先生 
              <input type="radio" name="sex" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="女士" checked>女士 
              <input type="radio" name="sex" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="保密">保密 
            <%}%> 
			<%if(sex.equals("保密")){%> <input type="radio" name="sex" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="先生">先生 
              <input type="radio" name="sex" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="女士">女士 
              <input type="radio" name="sex" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="保密" checked>保密 
              <%}%></td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">真实姓名:</div></td>
            <td height="25" width="326"> <input name="realname" type="text" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva," value="<%=realname%>" size="20" maxlength="10"> 
            </td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">电子邮件:</div></td>
            <td height="25" width="326"> <input name="email" type="text" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="<%=email%>" size="20" maxlength="50"> 
            </td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">家庭住址:</div></td>
            <td height="25" width="326"> <input type="text" name="address" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" size="20" maxlength="80" value="<%=address%>"> 
            </td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">联系电话:</div></td>
            <td height="25" width="326"> <input type="text" name="tel" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" size="20" maxlength="18" value="<%=tel%>"> 
            </td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">出生日期:</div></td>
            <td height="25" width="326"><input type="text" name="brith" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="<%=brith%>" size="20" maxlength="10"></td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">身份证号码:</div></td>
            <td height="25" width="326"> <input type="text" name="IDcard" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="<%=IDcard%>" size="20" maxlength="18"></td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">邮政编码:</div></td>
            <td height="25" width="326"> <input type="text" name="zipcode" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva" value="<%=zipcode%>" size="20" maxlength="6"></td>
          </tr>          
          <tr> 
          <tr> 
            <td height="25"> <div align="center">用户级别:</div></td>
            <td height="25" width="326"> <font color="#FF0000"><%=rate%></font></td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">是否已购物:</div></td>
            <td height="25" width="326"> 该用户在本商场共购物<font color="#FF0000"><%=whetherShop%></font>件(单)</td>
          </tr>
          <tr> 
            <td height="25"> <div align="center">是否有预定:</div></td>
            <td height="25" width="326">该用户在本商场共预定商品<font color="#FF0000"><%=preordainShop%></font>件(单)</td>
          </tr>
          <tr> 
            <td height="25"><div align="center">注册日期:</div></td>
            <td height="25"> <%=regTime%></td>
          </tr>
          <tr> 
            <td height="25"><div align="center">上一次登陆时间: </div></td>
            <td height="25"><%=lastTime%></td>
          </tr>
		  <tr> 
            <td height="25"><div align="center">交易方式: </div></td>
            <td height="25"><select name="mode" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva">
			                              <option value='<%=mode%>'><%=mode%></option>
										  <option value='在线交易'>在线交易</option>
                                          <option value='邮局支付'>邮局支付</option>
                                          <option value='EMS专递'>EMS专递</option>
                                          <option value='送货上门'>送货上门</option>
										  </select></td>
          </tr>
          <tr> 
            <td height="15" colspan="2"> </td>
          </tr>
          <tr> 
            <td height="20" colspan="2"> <div align="center"> 
                <input type="submit" name="regedit" value="修改" onClick="document.all.updatethis.value='true';" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva">
                <input type="reset" name="cancel" value="复回原位" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva">
                <input type="button" name="back" value="返回管理首页" onClick="javascript:self.location='main.jsp'" style="background-color:#ECECEC; border-style:1; font-size: 11; color: #000000; font-family: arial, verdana, geneva">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr> 
                    <td height="10"></td>
                  </tr>
                </table>
              </div></td>
          </tr>
        </table></td>
    </tr>
    <tr bgcolor="#CCCCCC"> 
      <td height="30" colspan="2" bgcolor="3969A5"></td>
    </tr>
  </form>
</table>
  <%}}%>
  <%
String update=request.getParameter("updatethis");
if(update!=null && update.equals("true"))
{
String id=request.getParameter("name");
String pwd=request.getParameter("pwd");
String newpwd=request.getParameter("newpwd");
if(!newpwd.equals(""))
{ pwd=newpwd; }
String pwdquery=request.getParameter("pwdquery");
byte[] tmp=pwdquery.getBytes("ISO8859_1");
pwdquery=new String(tmp);
String pwdanswer=request.getParameter("pwdanswer");
tmp=pwdanswer.getBytes("ISO8859_1");
pwdanswer=new String(tmp);
String sex=request.getParameter("sex");
tmp=sex.getBytes("ISO8859_1");
sex=new String(tmp);
String realname=request.getParameter("realname");
tmp=realname.getBytes("ISO8859_1");
realname=new String(tmp);
String email=request.getParameter("email");
String address=request.getParameter("address");
tmp=address.getBytes("ISO8859_1");
address=new String(tmp);
String tel=request.getParameter("tel");
String brith=request.getParameter("brith");
String IDcard=request.getParameter("IDcard");
String zipcode=request.getParameter("zipcode");
String mode=request.getParameter("mode");
tmp=mode.getBytes("ISO8859_1");
mode=new String(tmp);

sql="Update manager set pwd='"+pwd+"',pwdquery='"+pwdquery+"',pwdanswer='"+pwdanswer+"',sex='"+sex+"',realname='"+realname+"',email='"+email+"',address='"+address+"',tel='"+tel+"',brith='"+brith+"',IDcard='"+IDcard+"',zipcode='"+zipcode+"',mode='"+mode+"' where name='"+id+"'";
rs=data.executeQuery(sql);
response.sendRedirect("vip.jsp");
}%>

⌨️ 快捷键说明

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