daily pastebin goal
20%
SHARE
TWEET

Login

a guest May 23rd, 2018 115 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private static void Login() {
  2.         try{
  3.             System.out.println("Username :");
  4.             String username = input.readLine().trim();
  5.             System.out.println("Password");
  6.             String password = input.readLine().trim();
  7.            
  8.             String login ="SELECT*FROM login WHERE username='%s' AND password='%s'";
  9.             login = String.format(login, username, password);
  10.             rs = stmt.executeQuery(login);
  11.            
  12.             if(rs.next()){
  13.                 if(rs.getString("role").equals("admin")){
  14.                       showAdmin();
  15.                 }else if(rs.getString("role").equals("member")){
  16.                     showMember();
  17.                 }
  18.             }
  19.         }catch (Exception e){
  20.             e.printStackTrace();
  21.         }
  22.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top