Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. sendHeader(pw);
  2. sendHTML(pw, login);
  3.  
  4. if (request.equals("GET / HTTP/1.1"))
  5. {
  6.  
  7. if((br.readLine()) != null {
  8. if (request.contains("Cookie"))
  9. {
  10. String[] cookie_fields = request.split("=");
  11. n = Integer.parseInt(cookie_fields[1]) + 1;
  12. }
  13. }
  14.  
  15. else
  16. {
  17.  
  18. if((br.readLine()).equals(" ") {
  19. break;
  20. }
  21.  
  22. }
  23. }
  24.  
  25. if (request.equals("GET /favicon.ico HTTP/1.1"))
  26. {
  27. request = br.readLine();
  28. }
  29.  
  30. else if (request.contains("GET")) //General form: GET/?username=asdf&password=asdf HTTP/1.1
  31. {
  32. String[] initial_user_input = request.split("&");
  33. String u_side = initial_user_input[0];
  34. String p_side = initial_user_input[1];
  35.  
  36. String[] user = u_side.split("=");
  37. String username = user[1];
  38.  
  39. String[] pwd = p_side.split("=");
  40. String password = pwd[1];
  41.  
  42. if (check_username_and_password(username, password)) //Successful login - serve success page
  43. {
  44. sendHeader(pw);
  45. sendHTML(pw, login_success);
  46. }
  47.  
  48. else //Failure to login - serve failure page
  49. {
  50. sendHeader(pw);
  51. sendHTML(pw, login_fail);
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement