Guest User

Untitled

a guest
Apr 6th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. System.out.println("SISTEM LOGIN");
  2. System.out.println("INSERIRE NOMEUTENTE");
  3. Scanner scan= new Scanner(System.in);
  4. String user= scan.nextLine();
  5. System.out.println("INSERIRE PASSWORD");
  6. String pass= scan.nextLine();
  7.  
  8. try {
  9. boolean log = true;
  10. while(log) {
  11. //conn db
  12. Connection c = DriverManager.getConnection(url,usr,pswd);
  13. //creaz statement
  14. Statement ss = c.createStatement();
  15. //creaz codice sql
  16. String sql = " SELECT * FROM users WHERE user'" + user + "' && password='" + pass+ "' ";
  17. ResultSet res = ss.executeQuery(sql);
  18. if(res!=null) {
  19. System.out.println("LOGIN");
  20. log = false;
  21. }
  22. else System.out.println("LOGIN FAILE");
  23. }
  24. }
Add Comment
Please, Sign In to add comment