protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        ArrayList<CompRequest> comp = new ArrayList<CompRequest>();
        ArrayList<PaidRequest> paid = new ArrayList<PaidRequest>();
        ArrayList<Game> games = new ArrayList<Game>();
        ArrayList<Section> section = new ArrayList<Section>();

        String acctNum = request.getParameter("acct_num");
        String password = request.getParameter("pass");
        request.getSession().invalidate();
        Employee emp = new Employee();

        String message, url="/index.jsp";
        String dbURL = "jdbc:mysql://localhost:3306/itrs";
        String username = "root";
        String dbpassword = "sesame";
        try
        {
            Class.forName("com.mysql.jdbc.Driver");
        }
        catch (ClassNotFoundException e)
        {
           
        }
        try
        {
            Connection conn = DriverManager.getConnection(dbURL,username,dbpassword);
            Statement s = conn.createStatement();
            ResultSet r = s.executeQuery("SELECT * FROM employee NATURAL JOIN department WHERE emp_acctnum ='" + acctNum + "'");
            if (r.next())
            {
                emp = new Employee();
                emp.setEmployee(r);
                emp.setLoggedIn(password);
                message = "Employee found: " + emp.getFName() +  " " + emp.getLName();
                r.close();
                r = null;
                s.close();
                s = null;
                if (emp.getLoggedIn())
                {

                    url="/Main.jsp";
                    s = conn.createStatement();
                    r = s.executeQuery("SELECT * FROM comprequest NATURAL JOIN department NATURAL JOIN games " +
                            "NATURAL JOIN seating NATURAL JOIN employee " +
                            "WHERE emp_acctnum =" + emp.getAcctNum() );
                    while (r.next())
                    {
                        CompRequest c = new CompRequest();
                        c.setRequest(r);
                        comp.add(c);
                    } 
                    r.close();
                    r = null;
                    s.close();
                    s = null;
                    s = conn.createStatement();
                    r = s.executeQuery("SELECT * FROM paidrequest NATURAL JOIN department NATURAL JOIN games " +
                            "NATURAL JOIN seating NATURAL JOIN employee " +
                            "WHERE emp_acctnum =" + emp.getAcctNum() );
                    while (r.next())
                    {
                        PaidRequest p = new PaidRequest();
                        p.setRequest(r);
                        paid.add(p);
                    }
                    r.close();
                    r = null;
                    s.close();
                    s = null;
                    s = conn.createStatement();
                    r = s.executeQuery("SELECT * FROM games ORDER BY game_date");
                    Date date = new Date();
                    while(r.next())
                    {
                        Game g = new Game();
                        g.setGame(r);
                        if(date.compareTo(g.getGameDay()) >= 0)
                            g.setSoldOut(true);
                        games.add(g);
                    }
                    r.close();
                    r = null;
                    s.close();
                    s = null;

                    s = conn.createStatement();
                    r = s.executeQuery("SELECT * FROM seating ORDER BY sec_num");
                    while(r.next())
                    {
                        Section x = new Section();
                        x.setSection(r);
                        section.add(x);
                    }
                    request.getSession().setAttribute("games", games);
                    request.getSession().setAttribute("sections", section);
                    request.getSession().setAttribute("comp", comp);
                    request.getSession().setAttribute("paid", paid);

                }

                else  {
                message = "Invalid Password ";
                }
                
            }
            else
            {
                message = "Unknown user: " + acctNum + ". UserID not found.";
            }
        }
        catch (SQLException e)
        {
            message = "SQL Error: " + e.getMessage();
        }

        
        request.setAttribute("message", message);
        request.getSession().setAttribute("emp", emp);
        RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
        dispatcher.forward(request, response);
    }