public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        RequestDispatcher dispatcher;
        DBC dbc = new DBC();
        User u = new User(dbc,request);
        int pid=0;
        
        if(!u.isLoggedIn()){
            request.setAttribute("msg", "<p>You must be logged in to do that</p>");
            dispatcher = request.getRequestDispatcher("login.jsp");
            
            if (dispatcher != null) dispatcher.forward(request, response);
            else System.err.println("Error: File not found");
            
            return;
        }
        
        try{ pid = Integer.parseInt(request.getParameter("pid")); }
        catch(NumberFormatException e){;}
        
        if(pid > 0){
            Photo p = new Photo(dbc,pid);
            if(pid == p.getPid() && p.getOwner() == u.getUid()){
                request.setAttribute("photo",p);
                request.setAttribute("msg", "<p>Photo Updated</p>");
                dispatcher = request.getRequestDispatcher("editphoto.jsp?pid="+pid);
                if (dispatcher != null) dispatcher.forward(request, response);
                else System.err.println("Error: File not found");
            }
            else{
                request.setAttribute("msg", "<p>An error has occured</p>");
                dispatcher = request.getRequestDispatcher("viewphoto.jsp?pid="+pid);
                if (dispatcher != null) dispatcher.forward(request, response);
                else System.err.println("Error: File not found");
            }
        }
        else{
            dispatcher = request.getRequestDispatcher("addphoto.jsp");
            if (dispatcher != null) 
                dispatcher.forward(request, response);
            else System.err.println("Error: File not found");
        }
    }