Guest User

Untitled

a guest
Dec 9th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. public static void PacketSendLogin(String inData) throws SQLException
  2. {
  3. int result = 0;
  4. String[] temp;
  5. temp = inData.split("~");
  6. ResultSet SqlQuery = null;
  7.  
  8. String sql = "Select * from `Account` where `username` like '" + temp[1] + "' and `pass` like '" + temp[2] + "';";
  9. try
  10. {
  11. SqlQuery = Sqlstatement.SelectFromDB(sql);
  12. }
  13. catch (IOException ex)
  14. {
  15. Console.Write("Error in function RecognizePacket:LOGIN:IOException",console.CONSOLE_MYSQL.ordinal(), true, false);
  16. }
  17.  
  18. if(SqlQuery == null)
  19. return;
  20.  
  21. int accountId = 0;
  22. String userName = null;
  23. String pass = null;
  24. while (SqlQuery.next())
  25. {
  26. accountId = SqlQuery.getInt("id");
  27. userName = SqlQuery.getString("username");
  28. pass = SqlQuery.getString("pass");
  29. Console.Write("Result =" + accountId + "," + userName + "," + pass, console.CONSOLE_MYSQL.ordinal(), true, false);
  30. }
  31. if (temp[1] == userName && temp[2] == pass)
  32. {
  33. Console.Write("Naslo zaznam",console.CONSOLE_MYSQL.ordinal(), true, false);
  34. return;
  35. }
  36. else
  37. {
  38. Console.Write("Nenaslo zaznam",console.CONSOLE_MYSQL.ordinal(), true, false);
  39. return;
  40. }
  41. }
Add Comment
Please, Sign In to add comment