reg_ok.jsp
上传用户:cnkaiguan
上传日期:2014-08-25
资源大小:5403k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <div align="center"><a href="login.jsp">&lt;&lt;返回登录页面</a></div>
  2. <%@page contentType="text/html;charset=gbk"%>
  3. <%@page import="java.sql.*" %>
  4. <%
  5. String sidcustomer=request.getParameter("idcustomer");
  6. String idcustomer=new String(sidcustomer.getBytes("iso-8859-1"));
  7. String susername=request.getParameter("username");
  8. String username=new String(susername.getBytes("iso-8859-1"));
  9. String spassword=request.getParameter("password");
  10. String password=new String(spassword.getBytes("iso-8859-1"));
  11. String sdoublepassword=request.getParameter("doublepassword");
  12. String doublepassword=new String(sdoublepassword.getBytes("iso-8859-1"));
  13. String sphone=request.getParameter("phone");
  14. String phone=new String(sphone.getBytes("iso-8859-1"));
  15. String semail=request.getParameter("email");
  16. String email=new String(semail.getBytes("iso-8859-1"));
  17. String sstate=request.getParameter("selectstate");
  18. String state=new String(sstate.getBytes("iso-8859-1"));
  19. String scity=request.getParameter("city");
  20. String city=new String(scity.getBytes("iso-8859-1"));
  21. String szip=request.getParameter("zip");
  22. String zip=new String(szip.getBytes("iso-8859-1"));
  23. String saddress=request.getParameter("address");
  24. String address=new String(saddress.getBytes("iso-8859-1"));
  25. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  26. Connection con=DriverManager.getConnection("jdbc:odbc:booksystem");
  27. Statement sql=con.createStatement();
  28. ResultSet rs=sql.executeQuery("select * from customers where idcustomer='"+idcustomer+"' ");
  29. if(rs.next())
  30. response.sendRedirect("errorpage.jsp");
  31. else
  32. {
  33. sql.executeUpdate("insert into customers values('"+idcustomer+"','"+username+"','"+password+"','"+doublepassword+"','"+phone+"','"+email+"','"+state+"','"+city+"','"+zip+"','"+address+"')");
  34. out.print(" '"+username+"'用户注册成功,请记好您的ID号!!!"+"<br>");
  35. out.print("您的会员ID号为:[ "+idcustomer+" ]");
  36. }
  37. con.close();
  38. %>