毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 课程设计 >> 正文

jsp网上书店网页设计 第6页

更新时间:2009-6-1:  来源:毕业论文
jsp网上书店网页设计 第6页
          }
辣.public String getString(String s)
     { if(s==null) s="";
       try {byte a[]=s.getBytes("ISO-8859-1");
            s=new String(a);
           }
       catch(Exception e)
           { }
       return s;
     }
 %>
<% 
    String username=request.getParameter("username");
           username=getString(username);
 
    String password=request.getParameter("password");
           password=getString(password);

    String password1=request.getParameter("password1");
           password1=getString(password1);

    String password2=request.getParameter("password2");
       password2=getString(password2);
   
    Statement sql=null;
    ResultSet rs=null;
    boolean modify=false;
    boolean ifEquals=false;
            ifEquals=(password1.equals(password2))&&(password1.length()<=20)&&(password1.length()>=6);
    if(ifEquals==true)
        {try
           {    Connection con;
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con=DriverManager.getConnection("jdbc:odbc:shop","root","123456");
               sql=con.createStatement();
               String condition="SELECT * FROM users WHERE username = "+"'"+username+"'";
               rs =sql.executeQuery(condition);
               while(rs.next())
                 { String n=rs.getString("username");
                   String s=rs.getString("password");
                   if(username.equals(n)&&password.equals(s))
                    { 
                     modify=true;
                     out.print("<h3>密码修改成功!");
                     String c=
         "UPDATE users SET password = "+"'"+password1+"'"+" WHERE username = "+"'"+username+"'";
                     rs =sql.executeQuery(c);
                    }
                  }
           }
         catch(Exception ex) { ex.printStackTrace();}
        }
    else
   { out.print("<h3>两次密码输入不一致或新密码长度不够!");
       }
    if(modify==false&&ifEquals==true)
     { out.print("<br><h3>用户名或旧密码输入错误,请重新输入。");
     }
七.
public String getString(String s)
    { String str=s;
       try{ byte b[]=str.getBytes("ISO-8859-1");
            str=new String(b);
            return str;
     }
   catch(Exception e)
         { return str;
         }
    }
%>
  <%  //获取提交的用户名:
    String username=request.getParameter("username");
       if(username==null)
            {username=" ";
             }
      username=getString(username);
    //获取提交的密码:
    String password=request.getParameter("password");
       if(password==null)
            {password=" ";

上一页  [1] [2] [3] [4] [5] [6] [7] 下一页

jsp网上书店网页设计 第6页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。