modifysave.jsp
上传用户:szlmxq
上传日期:2014-01-31
资源大小:740k
文件大小:3k
源码类别:

Applet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=GBK" language="java" import="java.sql.*" errorPage="" %>
  2. <html>
  3. <head>
  4. <link href="css.css" rel="stylesheet" type="text/css">
  5. <title>用户资料更改</title>
  6. </head>
  7. <jsp:useBean id="mdb" class="ckstudio.db.faq2" scope="page"/>
  8. <link href=css.css rel=STYLESHEET type=text/css>
  9. <%!
  10. boolean IsMail(String user_mail){
  11. int index=user_mail.indexOf("@");
  12. int index2=user_mail.indexOf(".");
  13. if(index==-1 || index2==-1)
  14. return false;
  15. else return true;
  16. }
  17. %>
  18. <%
  19. //-------------------------------------------------------------------
  20. String errmsg="错误!",sql;
  21. boolean founderr=false;
  22. String user_name,user_namec,user_pass,user_adds,user_tel,user_mail,user_postcode;
  23. user_name=errmsg;
  24. user_namec=errmsg;
  25. user_pass=errmsg;
  26. user_adds=errmsg;
  27. user_tel=errmsg;
  28. user_mail=errmsg;
  29. user_postcode=errmsg;
  30. if(request.getParameter("user_namec").equals("")){
  31. errmsg=errmsg+"真实名不能为空,";
  32. founderr=true;
  33. }else user_namec=request.getParameter("user_namec");
  34. if(request.getParameter("user_pass").equals("")){
  35. errmsg=errmsg+"密码不能为空,";
  36. founderr=true;
  37. }else user_pass=request.getParameter("user_pass");
  38.     if(request.getParameter("user_adds").equals("")){
  39. errmsg=errmsg+"地址不能为空,";
  40. founderr=true;
  41. }else user_adds=request.getParameter("user_adds");
  42. if(request.getParameter("user_tel").equals("")){
  43. errmsg=errmsg+"电话号码不能为空,";
  44. founderr=true;
  45. }else user_tel=request.getParameter("user_tel");
  46. if(!IsMail(request.getParameter("user_mail"))){
  47. errmsg=errmsg+"你的E-mail有错误,";
  48. founderr=true;
  49. }else user_mail=request.getParameter("user_mail");
  50. if(request.getParameter("user_postcode").equals("")){
  51. errmsg=errmsg+"邮编不能为空,";
  52. founderr=true;
  53. }else user_postcode=request.getParameter("user_postcode");
  54.     
  55.     if(founderr==true){
  56.        out.print(errmsg);
  57.    }
  58.     else
  59. {
  60.         user_name=request.getParameter("user_name");
  61.         sql="select * from member where user_name='"+user_name+"'";
  62. ResultSet rs;
  63.         rs=mdb.executeQuery(sql);
  64.         if(rs.next()){
  65. rs.updateString("user_pass",user_pass);
  66.         rs.updateString("user_mail",user_mail);
  67.         rs.updateString("user_adds",user_adds);
  68.         rs.updateString("user_postcode",user_postcode);
  69.         rs.updateString("user_tel",user_tel);
  70.         rs.updateString("user_namec",user_namec);
  71.         rs.updateRow();
  72.         out.print("<font>");
  73.         out.print("用户资料更改完毕,请记牢你更改后的信息");
  74.         out.print("</font>");
  75. rs.close();
  76.        }
  77.    }
  78.    mdb.Close();
  79.    %>