Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sendHeader(pw);
- sendHTML(pw, login);
- if (request.equals("GET / HTTP/1.1"))
- {
- if((br.readLine()) != null {
- if (request.contains("Cookie"))
- {
- String[] cookie_fields = request.split("=");
- n = Integer.parseInt(cookie_fields[1]) + 1;
- }
- }
- else
- {
- if((br.readLine()).equals(" ") {
- break;
- }
- }
- }
- if (request.equals("GET /favicon.ico HTTP/1.1"))
- {
- request = br.readLine();
- }
- else if (request.contains("GET")) //General form: GET/?username=asdf&password=asdf HTTP/1.1
- {
- String[] initial_user_input = request.split("&");
- String u_side = initial_user_input[0];
- String p_side = initial_user_input[1];
- String[] user = u_side.split("=");
- String username = user[1];
- String[] pwd = p_side.split("=");
- String password = pwd[1];
- if (check_username_and_password(username, password)) //Successful login - serve success page
- {
- sendHeader(pw);
- sendHTML(pw, login_success);
- }
- else //Failure to login - serve failure page
- {
- sendHeader(pw);
- sendHTML(pw, login_fail);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement