#%@page import="java.sql.*"%*
#%@page contentType="text/html" pageEncoding="UTF-8"%*
#!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd"*
 
#html*
    #head*
        #meta http-equiv="Content-Type" content="text/html; charset=UTF-8"*
        #title*apnafb.com#/title*
    #/head*
    #body*
        #%! String fname,lname,email,password,sex,month; int date,year;%*
 
        #%
            Connection con =null;
            Statement st= null;
        try
        {
            Class.forName("com.mysql.jdbc.Driver");
            con=DriverManager.getConnection("jdbc:mysql://localhost:3306/snp","root","");
            st=con.createStatement();
            String sqlc;            
            sqlc="Select * from userinfo";
            email=request.getParameter("email");
            password=request.getParameter("password");
            Boolean exist=false;
            ResultSet rs= st.executeQuery(sqlc);
            while(rs.next())
              {
                if(rs.getString("semail").equals(email)&& rs.getString("spassword").equals(password))
                    {
                        exist=true;
                        fname=rs.getString("fname");
                        lname=rs.getString("lname");
                        sex=rs.getString("sex");
                        date=rs.getInt("date");
                        month=rs.getString("month");
                        year=rs.getInt("year");
                    }
              }
                if(!exist) response.sendRedirect("/snc/index.jsp");
        }            
        finally
        {
            try
            {
              if(st!=null)
              {
                  st.close();
              }
              if(con!=null)
              {
                  con.close();
              }
            }
            catch(SQLException s)
            {
 
            }
        }
 
        %*
        #center*#h1* Welcome #%=fname%* #%=lname%*  #/h1*#/center*
        #br*#br*
        #center*#h2*
                Your Password is #%=password%* #br*
                Your Email is #%=email%*    #br*
                You are #%=sex%* #br*
                Your Date of Birth is : #%=date%* #%=month%*, #%=year%* . #br*
 
                #h1* Thanks for Visiting Our Site again....!!#/h1*
 
            #/h2* #/center*
    #/body*
#/html*
 
 
No comments:
Post a Comment