All pastes #364477 Raw Edit

Unnamed

public text v1 · immutable
#364477 ·published 2007-02-20 05:15 UTC
rendered paste body
//Check to see if the user is not logged in
                if (obSess.getAttribute("userID") != null)
                {
                    //If the user is logged in, check to see if our processing flag is set
                    if (request.getParameter("processFlag") != null)
                    {
                        //If it is, a signup needs to be processed
                        processMensReg(out, obSess.getAttribute("userID").toString(), request);
                    }
                    //Otherwise display the signup form and start the series of checks
                    else
                    {
                        //If the user has paid section fees
                        if (checkSectionFees(out, obSess.getAttribute("userID").toString()))
                        {
                            //If the allowable dates to register have not passed
                            if (checkDate(out))
                            {
                                //Check if there are still available slots
                                if(checkSlots(out) > 1)
                                {
                                    //check if the user has hit their 3 guests per year limit.
                                    if(checkGuestLimit(out, obSess.getAttribute("userID").toString()))
                                    {
                                        //give them the form and let them choose a guest
                                        showSignupForm(out, true);
                                    }
                                    else
                                    {
                                        //give them the form but with no guest option
                                        showSignupForm(out, false);
                                        out.println("<p>NOTE: You have hit your 3 guests/year limit, so you will not be able to bring a guest.</p>");
                                    }                                
                                }
                                //If there is only 1 slot left, the user cannot signup with a guest
                                else if (checkSlots(out) == 1)
                                {  
                                    //give them the form but with no guest option
                                    showSignupForm(out, false);
                                    out.println("<p>NOTE: There is only one slot left, so you will not be able to bring a guest.</p>");
                                }
                                //If all slots are filled, display that message
                                else
                                {
                                    //We're all full up and can't take much more cap'n!
                                    displayError(out, "Sorry, All 40 slots for this mens night are full. Please try again next week.");
                                }
                            }
                            //The registration time has passed, and registration is not possible.
                            else
                            {
                                displayError(out, "Sorry, but it is too late to register. Registration opens 5 days in advance.");
                            }
                        }
                        //The section fees weren't paid
                        else
                        {
                            displayError(out, "You have not paid your section fees. You must pay them before you can sign up for mens night.");
                        }
                    }
                }
                //The user hasn't logged in
                else
                {
                    out.println("<h1>Not Logged In.</h1>");
                    out.println("<p>Redirecting you to the login page now...</p>");
                    //Redirect ourselves to a different page
                    response.sendRedirect("Login");
                }