Person.jsp
上传用户:sdtxjx
上传日期:2022-07-09
资源大小:2937k
文件大小:5k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=GBK" language="java" buffer="32kb"%>
  2. <%@ page import="dreamtime.dreamnews.*"%>
  3. <%@ include file="Session.jsp"%>
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Language" content="zh-cn">
  7. <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  8. <link href="css/bodystyle.css" rel="stylesheet" type="text/css">
  9. <script language="javascript" src="js/post.js"></script>
  10. <title>用户管理</title>
  11. </head>
  12. <body> 
  13.   <%
  14.    request.setCharacterEncoding("GBK");   //设置编码方式为GBK
  15. User user = new User();
  16. Function Fun = new Function();
  17. String Action = request.getParameter("Action");
  18. String IP = request.getRemoteAddr(); //得到客户端Ip地址
  19. String AdminName = (String)session.getAttribute("AdminName");
  20. String  AdminID = (String)session.getAttribute("AdminID");
  21. String sOK = "";
  22. if (Action == null || Action.equals("")) Action = "View";
  23. /************************* 查看当前管理赠用户信息  ***********************/
  24. if (Action.equals("View"))
  25. {
  26. sOK = user.ViewUser(AdminID);
  27. if(!sOK.equals("No"))
  28. out.print(sOK);
  29. else 
  30. {
  31. out.println(Fun.OutError("读取管理理员信息出错!"));
  32. return;
  33. }
  34. }
  35. /********************** 修改用户资料的表单  *********************************/
  36. else if (Action.equals("Edit"))
  37. {
  38. sOK = user.EditUser(AdminID,false);
  39. if(!sOK.equals("No"))
  40. out.print(sOK);
  41. else 
  42. {
  43. out.println(Fun.OutError("读取管理理员信息出错!"));
  44. return;
  45. }
  46. }
  47. /********************** 修改用户保存 *********************************/
  48. else if (Action.equals("SaveEdit"))
  49. {
  50. String [] s = new String [13];
  51. String Year = request.getParameter("Year");
  52. String Month = request.getParameter("Month");
  53. String Day = request.getParameter("Day");
  54. String UserBirthday = Year + "-" + Month + "-" + Day;
  55. s[0] = AdminID;
  56. s[1] = null;
  57. s[2] = request.getParameter("AdminType");
  58. s[3] = (new java.util.Date()).toLocaleString();
  59. s[4] = request.getParameter("UserName");
  60. s[5] = request.getParameter("UserSex");
  61. s[6] = UserBirthday;
  62. s[7] = request.getParameter("UserEmail");
  63. s[8] = request.getParameter("UserQQ");
  64. s[9] = request.getParameter("UserTel");
  65. s[10] = request.getParameter("UserAddress");
  66. s[11] = request.getParameter("UserZip");
  67. s[12] = request.getParameter("UserInfo");
  68. sOK = user.SaveEdit(s,AdminName,IP,false);
  69. if (sOK.equals("Yes")) 
  70.  out.print("<script>alert('修改个人资料成功!');location.href='Person.jsp';</script>");
  71. else 
  72. {
  73. out.print(Fun.OutError(sOK));
  74. return;
  75. }
  76. }
  77. /********************** 修改密码保存 *****************************/
  78. else if (Action.equals("SaveEditPwd"))
  79. {
  80. String [] s = new String [5];
  81. String AdminPwd2 = request.getParameter("AdminPwd2");
  82. s[0] = request.getParameter("OldPwd");
  83. s[1] = request.getParameter("AdminPwd");
  84. s[2] = AdminName;
  85. s[3] = IP;
  86. s[4] = AdminID;
  87. if(AdminPwd2.equals(s[1]))
  88. {
  89. sOK = user.SaveEditPwd(s);
  90. if (sOK.equals("Yes")) 
  91.  out.print("<script>alert('修改密码成功!');location.href='Person.jsp';</script>");
  92. else 
  93. {
  94. out.print(Fun.OutError(sOK));
  95. return;
  96. }
  97. }
  98. else  
  99. {
  100. out.print(Fun.OutError("您两次输入的密码不一样,请重试!"));
  101. return;
  102. }
  103. }
  104. %>
  105. <% if (Action.equals("Mod1")) { %>
  106. <br><br> 
  107. <form action="Person.jsp" method="POST" name="User"  onSubmit="return CheckModPwd()">
  108. <table width="90%"  border="1" align="center" cellpadding="2" cellspacing="0">
  109.           <tr background="images/bg.gif">
  110.             <td height="27" colspan="2" background="images/bg.gif"><div align="center" class="title"><strong>修改密码</strong></div></td>
  111.           </tr>
  112.           <tr>
  113.             <td width="43%" height="25"><div align="right" class="chinese">请输入原密码:</div></td>
  114.             <td width="57%"><input name="OldPwd" type="password" class="chinese" id="OldPwd" size="20" maxlength="16"> &nbsp;</td>
  115.           </tr>
  116.           <tr>
  117.             <td height="25"><div align="right" class="chinese">请输入新密码:</div></td>
  118.             <td><input name="AdminPwd" type="password" class="chinese" id="AdminPwd" size="20" maxlength="16">&nbsp;</td>
  119.           </tr>
  120.           <tr>
  121.             <td height="25"><div align="right" class="chinese">请确认新密码:</div></td>
  122.             <td>
  123.               <input name="AdminPwd2" type="password" class="chinese" id="AdminPwd2" size="20" maxlength="16"></td>
  124.           </tr>
  125.           <tr>
  126.             <td height="30" colspan="2"><div align="center">
  127.                 <input name="Submit" type="submit" class="button" value="确定">
  128.                 <input name="Action" type="hidden" id="Action" value="SaveEditPwd">
  129.                 <input name="Return" type="button" class="button" id="Return" value="返回" onClick="location.href='Person.jsp';">
  130.             </div></td>
  131.           </tr>
  132.   </table>
  133. </form>
  134. <br><br>
  135. <% } %>
  136. </body>
  137. </html>