好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

SQL Server实现用户注册

form action = "zhuChe.jsp" method = "post" onsubmit = " return reg(this);" > < div id = "div2" > < p style = "margin -left :30px" >< img src = " image / pic_zc.gif" ></ img ></ p > < div style = "width:350px;height:20px;margin -left :30px;margin - top : - 10px" > < p >< hr /></ p > </ div > < p style = "margin -left :70px" > 请填写您的姓名: < input type = " text " name = "userName" ></ p > < p style = "margin -left :200px;margin - top : - 10px;font - size:12px" > 请填写有效的Name作为下次登入的用户名,同时我们也会这个地址发送您的账户信息、订单通知等。 </ p > < p style = "margin -left :100px" > 请设定密码: < input type = "password" value = "" name = "password" datatype = " * 6 - 15 " errormsg = "密码范围在6 ~ 15位之间,不能使用空格!" /></ p > < p style = "margin -left :35px" > 请再次输入设定密码: < input type = "password" value = "" name = "repassword" datatype = " * " recheck = password" errormsg = "您两次输入的账号密码不一致!" /></ p > < p style = "margin -left :80px" > 请输入验证码: < input type = " text " name = "yanz" style = "width:50px" ></ p > < p style = "margin -left :250px;margin - top : - 40px;" >< img src = " image / code_img.gif" ></ img ></ p > < p style = "margin -left :250px;margin - top : - 15px;font - size:12px" > 看不清换一张 </ p > < p style = " text - align:center;" > 请阅读 < a href >< font color = "red" style = "font - weight:bold" > 《"V + 网站"服务条款》 </ font ></ a ></ p > < p style = " text - align:center;" >< img src = " image / sumit_bg.gif" ></ img ></ p > < p style = "margin -left :129px;font - weight:bold;color:#fff;margin - top : - 41px;" >< input type = "submit" value = "同意以上条款并注册" style = "color:#8D0223" ></ p > </ div > < ! -- 右边div框架结束--> </ form >
 <% @ page language = "java" import = "java.util. * " pageEncoding = "utf -  8 " %> 
 <%  @page  import = "jdbc.sqlServer" %> 
 <%  @page  import = "java.sql.Connection" %> 

 <%  @page  import = "java.sql.ResultSet" %> 
 <%  @page  import = "java.sql.PreparedStatement" %> 
 <%  









       String userName   =   request.getParameter("userName");
      userName   =  new String( userName.getBytes("ISO -  8859  -  1 "),"utf -  8  ");
       String   money   =  request.getParameter(" money  ");
      
       String password   =   request.getParameter("password");
         if (userName ==  null   &&  password ==  null  ){
           
           %>    < script type = " text  / javascript" >  
            alert("用户名或密码不为空");
            
            location  =  "doLog.jsp";
              </ script > 
            <%   
           
       }

      %> 
      <% 


           //  引用连接数据库方法
         sqlServer sq  =  new sqlServer();
             //  得到数据库连接
          Connection con   =   sq.getConnection();
             //  编写sql语句
         String sql  = " insert   into  Admin  values   (?,?,?)";
           
           //  得到数据库操作对象
       
         PreparedStatement st   =  con.prepareStatement(sql);
         st.setString(  1  ,userName);
         st.setInt(  2 , 200  );
         st.setString(  3  ,password);
       
     
              //   得到查询的结果
        
                
 
        if (st.executeUpdate() >  0  ){
            %> 
             < script type = " text  / javascript" >  
                alert("注册成功");
                location  =  "LinDao.jsp";
              </ script > 
           <%  

             
      
      
    }  else  {
                  
            %> 
          
              < script language = "javascript" >  
       function   check  (){
      if  (password !=  password2){    
        alert("两次密码输入不一致,你看着办吧!");
        }
      return   true;
    }
      </ script > 
          
           <%  
                 
              }


      
       %> 
     

 

SQL Server实现用户注册

标签:

查看更多关于SQL Server实现用户注册的详细内容...

  阅读:28次