Exemple #1
0
  public static void main(String args[]) {

    wmatrix wmatrix = new wmatrix();
    wmatrix.start();
    try {
      PrintWriter profilefout =
          new PrintWriter(
              new BufferedWriter(
                  new FileWriter(
                      "profile_"
                          + Data.kinease
                          + "_"
                          + Data.code
                          + "_"
                          + Data.windows_size
                          + ".csv")));

      profilefout.print("Position=");
      for (int j = 0; j < Data.windows_size; j++) {
        profilefout.print("," + (j - Data.windows_size / 2));
      }
      profilefout.println();

      for (int i = 0; i < 20; i++) {
        for (int j = 0; j < Data.windows_size; j++) {
          profilefout.print("," + wm[i][j]);
        }
        profilefout.println();
      }
      profilefout.close();

    } catch (IOException ex) {

    }
  }
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");

    PrintWriter out = response.getWriter();
    Connection conn = null;
    PreparedStatement pstmt = null;
    try {
      System.out.println("Enrollno: 130050131049");
      // STEP 2: Register JDBC driver
      Class.forName(JDBC_DRIVER);

      // STEP 3: Open a connection
      System.out.println("Connecting to a selected database...");
      conn = DriverManager.getConnection(DB_URL, USER, PASS);
      System.out.println("Connected database successfully...");

      // STEP 2: Executing query
      String sql = "SELECT * FROM logindetails WHERE name = ?";
      pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, "Krut");

      ResultSet rs = pstmt.executeQuery();
      out.print("| <b>Name</b>| ");
      out.print("<b>Password</b>| ");
      out.println("</br>\n-------------------------------</br>");
      while (rs.next()) {
        out.println();
        out.print("| " + rs.getString(1));
        out.print("| " + rs.getString(2) + "|");
        out.println("</br>");
      }

    } catch (SQLException se) {
      // Handle errors for JDBC
      se.printStackTrace();
    } catch (Exception e) {
      // Handle errors for Class.forName
      e.printStackTrace();
    } finally {
      // finally block used to close resources
      try {
        if (pstmt != null) conn.close();
      } catch (SQLException se) {
      } // do nothing
      try {
        if (conn != null) conn.close();
      } catch (SQLException se) {
        se.printStackTrace();
      } // end finally try
    } // end try
  }
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      Connection con =
          DriverManager.getConnection(Utility.connection, Utility.username, Utility.password);

      String email = request.getParameter("email_id");

      String number = "";
      boolean exists = false;
      String user_name = "";
      int user_id = -1;
      String str1 = "SELECT USER_ID,NAME,PHONE_NUMBER FROM USERS WHERE EMAIL_ID=?";
      PreparedStatement prep1 = con.prepareStatement(str1);
      prep1.setString(1, email);
      ResultSet rs1 = prep1.executeQuery();
      if (rs1.next()) {
        exists = true;
        user_id = rs1.getInt("USER_ID");
        user_name = rs1.getString("NAME");
        number = rs1.getString("PHONE_NUMBER");
      }
      int verification = 0;
      JSONObject data = new JSONObject();
      if (exists) {
        verification = (int) (Math.random() * 9535641 % 999999);
        System.out.println("Number " + number + "\nVerification: " + verification);
        SMSProvider.sendSMS(
            number, "Your One Time Verification Code for PeopleConnect Is " + verification);
      }

      data.put("user_name", user_name);
      data.put("user_id", user_id);
      data.put("verification_code", "" + verification);
      data.put("phone_number", number);

      String toSend = data.toJSONString();
      out.print(toSend);
      System.out.println(toSend);

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      out.close();
    }
  }
Exemple #4
0
  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    res.setContentType("text/html");
    PrintWriter toClient = res.getWriter();
    toClient.println("<!DOCTYPE HTML>");
    toClient.println("<html>");
    toClient.println("<head><title>Books</title></head>");
    toClient.println("<body>");
    toClient.println("<a href=\"index.html\">Home</A>");
    toClient.println("<h2>List of books</h2>");

    HttpSession session = req.getSession(false);
    if (session != null) {
      String name = (String) session.getAttribute("name");
      if (name != null) {
        toClient.println("<h2>name: " + name + "</h2>");
      }
    }

    toClient.print("<form action=\"bookOpinion\" method=GET>");
    toClient.println("<table border='1'>");

    String sql = "Select code, title, author FROM books";
    System.out.println(sql);
    try {
      Statement statement = connection.createStatement();
      ResultSet result = statement.executeQuery(sql);
      while (result.next()) {
        toClient.println("<tr>");
        String codeStr = result.getString("code");
        toClient.println(
            "<td><input type=\"radio\" name=\"book" + "\" value=\"" + codeStr + "\"></td>");
        toClient.println("<td>" + codeStr + "</td>");
        toClient.println("<td>" + result.getString("title") + "</td>");
        toClient.println("<td>" + result.getString("author") + "</td>");
        toClient.println("</tr>");
      }
    } catch (SQLException e) {
      e.printStackTrace();
      System.out.println("Resulset: " + sql + " Exception: " + e);
    }
    toClient.println("</table>");
    toClient.println("<textarea rows=\"8\" cols=\"60\" name=\"comment\"></textarea><BR>");
    toClient.println("<input type=submit>");
    toClient.println("</form>");
    toClient.println("</body>");
    toClient.println("</html>");
    toClient.close();
  }
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      Connection con =
          DriverManager.getConnection(Utility.connection, Utility.username, Utility.password);

      int user_id = Integer.parseInt(request.getParameter("user_id"));
      int question_id = Integer.parseInt(request.getParameter("question_id"));
      int option = Integer.parseInt(request.getParameter("option"));

      System.out.println("uid: " + user_id + "\nquestion: " + question_id + "\noption: " + option);
      String str1 = "INSERT INTO VOTES(USER_ID, QUESTION_ID,OPTION_VOTED) VALUES (?,?,?)";
      PreparedStatement prep1 = con.prepareStatement(str1);
      prep1.setInt(1, user_id);
      prep1.setInt(3, option);
      prep1.setInt(2, question_id);
      prep1.execute();

      String str2 = "SELECT OPTION_" + option + " FROM ARCHIVE_VOTES WHERE QUESTION_ID=?";
      PreparedStatement prep2 = con.prepareStatement(str2);
      prep2.setInt(1, question_id);
      int count = 0;
      ResultSet rs2 = prep2.executeQuery();
      if (rs2.next()) {
        count = rs2.getInt("OPTION_" + option);
      }
      count++;
      String str3 = "UPDATE ARCHIVE_VOTES SET OPTION_" + option + "=? WHERE QUESTION_ID=?";
      PreparedStatement prep3 = con.prepareStatement(str3);
      prep3.setInt(1, count);
      prep3.setInt(2, question_id);
      prep3.executeUpdate();

      out.print("You Vote has been recorded! Thank you!");
      System.out.println(
          "Voted for question " + question_id + ", by user " + user_id + ", for option " + option);

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      out.close();
    }
  }
Exemple #6
0
  @Override
  public void run() {
    // TODO Auto-generated method stub
    try {
      Socket s = new Socket(hostin, portin);
      InputStream ins = s.getInputStream();
      OutputStream os = s.getOutputStream();
      ir = new BufferedReader(new InputStreamReader(ins));
      pw = new PrintWriter(new OutputStreamWriter(os), true);

      pw.print(nick);
      while (true) {
        String line = ir.readLine();
        jta.append(line + "\n");
        jsp.getVerticalScrollBar().setValue(jsp.getVerticalScrollBar().getMaximum());
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  /** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */
  @SuppressWarnings("unchecked")
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    response.setContentType("application/json");
    response.setHeader("Cache-Control", "nocache");
    response.setCharacterEncoding("utf-8");
    PrintWriter out = response.getWriter();
    StringWriter result = new StringWriter();

    // get received JSON data from request
    BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream()));
    String postData = "";
    if (br != null) {
      postData = br.readLine();
    }

    try {
      JSONObject json = (JSONObject) new JSONParser().parse(postData);
      JSONObject resultObj = new JSONObject();
      JSONArray list = new JSONArray();
      List<Tracking> trackingList = new ArrayList<Tracking>();

      // get the website list
      if (json.get("type").equals("websiteslist")) {
        trackingList = trackingDao.websiteList(pool);
        for (Tracking item : trackingList) {
          list.add(item.getWebsite());
        }
      }
      // render report
      else if (json.get("type").equals("submit")) {
        if (json.get("criteria").equals("date")) {
          // render repoty by date
          trackingList = trackingDao.getListByDate(pool, json.get("date").toString());
        } else if (json.get("criteria").equals("daterange")) {
          // render repoty by date range
          trackingList =
              trackingDao.getListByDateRange(
                  pool, json.get("fromdate").toString(), json.get("todate").toString());
        } else if (json.get("criteria").equals("website")) {
          // render repoty by website
          String website = (json.get("website") == null ? "" : json.get("website").toString());
          trackingList = trackingDao.getListByWebsite(pool, website);
        }

        for (Tracking item : trackingList) {
          JSONObject trackingObj = new JSONObject();
          trackingObj.put("date", item.getDate());
          trackingObj.put("website", item.getWebsite());
          trackingObj.put("visit", item.getVisit());
          list.add(trackingObj);
        }
      }
      resultObj.put("result", list);
      resultObj.writeJSONString(result);
      // finally output the json string
      out.print(result.toString());
    } catch (ParseException | SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  // Print <Cluster>-prototype-ini.dat file
  // File format:
  // [Prototype] CombatOrganization|CivilanOrganization
  // [UniqueId] "UTC/CombatOrg"
  // [UIC] "UIC/<OrganizationName>
  // [Relationship]
  // Superior  <Superior> ""
  // Support   <Supported> <Role>
  // [TypeIdentificationPG]
  // TypeIdentification String "UTC/RTOrg"
  // Nomenclature String <Nomenclature>
  // AlternateTypeIdentification String "SRC/<SRC>"
  // [ClusterPG]
  // MessageAddress String <OrganizationName>
  // [OrganizationPG]
  // Roles Collection<Role> <Role>
  // [MilitaryOrgPG]
  // UIC String <UIC>
  // Echelon String <Echelon>
  // UTC String <UTC>
  // SRC String <SRC>
  //
  private void dumpOrganizationInfo(Hashtable all_organizations, String path) throws IOException {

    Hashtable supportedOrgRoles = null;

    for (Enumeration e = all_organizations.keys(); e.hasMoreElements(); ) {
      supportedOrgRoles = new Hashtable();
      String org_name = (String) e.nextElement();
      OrganizationData org_data = (OrganizationData) all_organizations.get(org_name);
      PrintWriter org_file;

      try {
        if (path != null) {
          org_file = createPrintWriter(path + File.separator + org_name + "-prototype-ini.dat");
        } else {
          org_file = createPrintWriter(org_name + "-prototype-ini.dat");
        }
        org_file.println(
            "[Prototype] "
                + (org_data.isCivilan() ? "CivilianOrganization" : "MilitaryOrganization"));
        org_file.println("\n[UniqueId] " + '"' + "UTC/CombatOrg" + '"');
        org_file.println("\n[UIC] " + '"' + "UIC/" + org_name + '"');

        // Write out Superior/Support Relationships
        org_file.println("\n[Relationship]");
        if (org_data.mySuperior != null) {
          org_file.println("Superior " + '"' + org_data.mySuperior + '"' + " " + '"' + '"');
        }

        for (Enumeration rels = org_data.mySupportRelations.elements(); rels.hasMoreElements(); ) {
          SupportRelation suprel = (SupportRelation) rels.nextElement();

          if (!supportedOrgRoles.containsKey(suprel.mySupportedOrganization)) {
            supportedOrgRoles.put(suprel.mySupportedOrganization, suprel.myRole);
          } else {
            String role = (String) supportedOrgRoles.get(suprel.mySupportedOrganization);
            role = role + ", " + suprel.myRole;
            supportedOrgRoles.put(suprel.mySupportedOrganization, role);
          }
        }

        for (Enumeration roles = supportedOrgRoles.keys(); roles.hasMoreElements(); ) {
          String supportedOrg = (String) roles.nextElement();
          String role = (String) supportedOrgRoles.get(supportedOrg);
          org_file.println("Supporting " + '"' + supportedOrg + '"' + " " + '"' + role + '"');
        }

        // Print TypeIdentificationPG fields
        org_file.println("\n[TypeIdentificationPG]");
        org_file.println("TypeIdentification String " + '"' + "UTC/RTOrg" + '"');
        org_file.println("Nomenclature String " + '"' + org_data.myNomenclature + '"');
        org_file.println(
            "AlternateTypeIdentification String " + '"' + "SRC/" + org_data.mySRC + '"');

        // Print ClusterPG info
        org_file.println("\n[ClusterPG]");
        org_file.println("MessageAddress String " + '"' + org_name + '"');

        // Print OrganizationPG (Roles) info
        org_file.println("\n[OrganizationPG]");
        org_file.print("Roles Collection<Role> " + '"');
        boolean is_first = true;
        for (Enumeration roles = org_data.myRoles.elements(); roles.hasMoreElements(); ) {
          String role = (String) roles.nextElement();
          if (!is_first) {
            org_file.print(", ");
          }
          org_file.print(role);
          is_first = false;
        }
        org_file.println('"');

        // Print MilitaryOrgPG info
        org_file.println("\n[MilitaryOrgPG]");
        org_file.println("UIC String " + '"' + org_data.myUIC + '"');
        if (org_data.myEchelon.intValue() != -1) {
          org_file.println("Echelon String " + '"' + org_data.myEchelon.intValue() + '"');
        } else {
          org_file.println("Echelon String " + '"' + '"');
        }
        org_file.println("UTC String " + '"' + org_data.myUTC + '"');
        org_file.println("SRC String " + '"' + org_data.mySRC + '"');
        if (org_data.myIsReserve == true) {
          org_file.println("IsReserve       boolean     true");
        } else {
          org_file.println("IsReserve       boolean     false");
        }

        // Print HomeLocationPG info under Military Org PG
        org_file.println(
            "HomeLocation     GeolocLocation   "
                + "\"GeolocCode="
                + org_data.myHomeGeoLoc
                + ", InstallationTypeCode="
                + org_data.myHomeInstallCode
                + ", CountryStateCode="
                + org_data.myHomeCSCode
                + ", CountryStateName="
                + org_data.myHomeCSName
                + ", IcaoCode="
                + org_data.myHomeICAOCode
                + ", Name="
                + org_data.myHomeLocation
                + ", Latitude=Latitude "
                + org_data.myHomeLatitude
                + "degrees, Longitude=Longitude "
                + org_data.myHomeLongitude
                + "degrees\"");

        /*
        // Print AssignmentPG info
        org_file.println("\n[AssignmentPG]");
        org_file.println("GeolocCode            String    "+'"'+org_data.myAssignedGeoLoc+'"');
        org_file.println("InstallationTypeCode  String    "+'"'+org_data.myAssignedInstallCode+'"');
        org_file.println("CountryStateCode      String    "+'"'+org_data.myAssignedCSCode+'"');
        org_file.println("CountryStateName      String    "+'"'+org_data.myAssignedCSName+'"');
        org_file.println("IcaoCode              String    "+'"'+org_data.myAssignedICAOCode+'"');
        */
        // Print CSSCapabilities info
        if (org_data.myCSSCapabilities != null) {
          is_first = true;
          org_file.println("\n[CSSCapabilityPG]");
          org_file.print("Capabilities Collection<CSSCapability> " + '"');
          for (Enumeration eCap = org_data.myCSSCapabilities.elements(); eCap.hasMoreElements(); ) {
            CSSCapabilities cssCap = (CSSCapabilities) eCap.nextElement();
            if (!is_first) {
              org_file.print(", ");
            }
            org_file.print(cssCap.capability);
            org_file.print(" " + cssCap.qty);
            if (!cssCap.period.equals("")) {
              org_file.print(" Duration=" + cssCap.period);
            }
            is_first = false;
          }
          org_file.println('"');
        }

        org_file.close();
      } catch (IOException exc) {
        System.out.println("IOException:  " + exc);
        System.exit(-1);
      }
    }
  }
  /**
   * Remove a quiz from a course. Also deletes all the quiz visualization files from the students'
   * folder who is registered in the course. Caution: vizualisation file will be deleted eventhough
   * it also relates to anther course if the student is also registered to that course. (FIX ME!)
   * Throws InvalidDBRequestException if the quiz is not registered in the course, error occured
   * during deletion, or other exception occured.
   *
   * @param quizName quiz name
   * @param courseID course id (course number + instructor name)
   * @throws InvalidDBRequestException
   */
  public void deleteQuiz(String quizName, String courseID)
      throws InvalidDBRequestException, FileFailureException {
    try {
      Class.forName(GaigsServer.DBDRIVER);
      db =
          DriverManager.getConnection(GaigsServer.DBURL, GaigsServer.DBLOGIN, GaigsServer.DBPASSWD);

      Statement stmt = db.createStatement();
      ResultSet rs;

      int count = 0;

      // check if quiz is used in the course
      rs =
          stmt.executeQuery(
              "select test_name from courseTest where test_name = '"
                  + quizName
                  + "' and course_id = '"
                  + courseID
                  + "'");
      if (!rs.next()) throw new InvalidDBRequestException("Quiz is not registered for the course");
      else {
        // remove quiz from course
        count =
            stmt.executeUpdate(
                "delete from courseTest where course_id = '"
                    + courseID
                    + "' and test_name = '"
                    + quizName
                    + "'");
        if (count != 1) throw new InvalidDBRequestException("Error occured during deletion");
        else {
          // delete quiz visualization files
          rs =
              stmt.executeQuery(
                  "select distinct unique_id, scores.user_login from scores, courseRoster "
                      + "where courseRoster.user_login = scores.user_login "
                      + "and course_id = '"
                      + courseID
                      + "' "
                      + "and test_name = '"
                      + quizName
                      + "'");
          while (rs.next()) {
            deleteVisualization(rs.getString(1), rs.getString(2), quizName);
            count =
                stmt.executeUpdate(
                    "delete from scores where unique_id = " + rs.getString(1).trim());
          }

          // rewrite the menu for the course
          rs =
              stmt.executeQuery(
                  "select distinct menu_text, name, script_type, visual_type from test t, courseTest c "
                      + "where t.name = c.test_name "
                      + "and course_id = '"
                      + courseID
                      + "'");
          PrintWriter fileOStream =
              new PrintWriter(new FileOutputStream("./html_root/cat/" + courseID + ".list"));
          while (rs.next()) {
            if (debug)
              System.out.println(
                  rs.getString(1).trim()
                      + "\n"
                      + rs.getString(2).trim()
                      + " "
                      + rs.getString(3).trim()
                      + " "
                      + rs.getString(4).trim().toLowerCase()
                      + "\n****\n");
            fileOStream.print(
                rs.getString(1).trim()
                    + "\n"
                    + rs.getString(2).trim()
                    + " "
                    + rs.getString(3).trim()
                    + " "
                    + rs.getString(4).trim().toLowerCase()
                    + "\n****\n");
          }
          fileOStream.flush();
          fileOStream.close();
        }
      }

      rs.close();
      stmt.close();
      db.close();
    } catch (SQLException e) {
      System.err.println("Invalid SQL in addQuiz: " + e.getMessage());
      throw new InvalidDBRequestException("??? ");
    } catch (ClassNotFoundException e) {
      System.err.println("Driver Not Loaded");
      throw new InvalidDBRequestException("Internal Server Error");
    } catch (Exception e) {
      System.err.println("Error in recreating menu for course: " + courseID);
      System.err.println(e.getMessage());
      throw new FileFailureException();
    }
  }
  /**
   * Add a quiz to a course if not already so. Also write the menu file for the course. Throws
   * InvalidDBRequestException if quiz already in the course, error occured during insertion, or
   * other exception occured. Throws FileFailureException if fail to append quiz to the menu.
   *
   * @param quizname the quiz name
   * @param courseID the course id (course number + instructor name)
   * @throws InvalidDBRequestException
   */
  public void addQuiz(String quizName, String courseID)
      throws InvalidDBRequestException, FileFailureException {
    try {
      Class.forName(GaigsServer.DBDRIVER);
      db =
          DriverManager.getConnection(GaigsServer.DBURL, GaigsServer.DBLOGIN, GaigsServer.DBPASSWD);

      Statement stmt = db.createStatement();
      Statement cstmt = db.createStatement();
      ResultSet rs, courseRS;

      int count = 0;

      // get quiz info
      courseRS =
          cstmt.executeQuery(
              "select menu_text, script_type, visual_type from test where name = '"
                  + quizName
                  + "'");

      // check if quiz in the database
      if (!courseRS.next())
        throw new InvalidDBRequestException("Quiz is not registered in the database");
      else {
        // check if quiz already in the course
        rs =
            stmt.executeQuery(
                "select test_name from courseTest where test_name = '"
                    + quizName
                    + "' and course_id = '"
                    + courseID
                    + "'");
        if (rs.next()) throw new InvalidDBRequestException("Quiz is already added for the course");
        else {
          count =
              stmt.executeUpdate(
                  "insert into courseTest (course_id, test_name) values ('"
                      + courseID
                      + "', '"
                      + quizName
                      + "')");
          if (count != 1) throw new InvalidDBRequestException("Error occured during insertion");
          else {
            // append quiz info to the course menu
            try {
              PrintWriter fileOStream =
                  new PrintWriter(
                      new FileOutputStream("./html_root/cat/" + courseID + ".list", true));
              if (debug)
                System.out.println(
                    courseRS.getString(1).trim()
                        + "\n"
                        + quizName
                        + " "
                        + courseRS.getString(2).trim()
                        + " "
                        + courseRS.getString(3).trim().toLowerCase()
                        + "\n****\n");
              fileOStream.print(
                  courseRS.getString(1).trim()
                      + "\n"
                      + quizName
                      + " "
                      + courseRS.getString(2).trim()
                      + " "
                      + courseRS.getString(3).trim().toLowerCase()
                      + "\n****\n");
              fileOStream.flush();
              fileOStream.close();
            } catch (Exception e) {
              System.err.println("Error in creating the menu: " + e.getMessage());
              throw new FileFailureException("Error in creating the menu: " + e.getMessage());
            }
          }
        }
      }

      courseRS.close();
      rs.close();
      stmt.close();
      cstmt.close();
      db.close();
    } catch (SQLException e) {
      System.err.println("Invalid SQL in addQuiz: " + e.getMessage());
      throw new InvalidDBRequestException("??? ");
    } catch (ClassNotFoundException e) {
      System.err.println("Driver Not Loaded");
      throw new InvalidDBRequestException("Internal Server Error");
    }
  }
Exemple #11
0
  // New -- returns data in HashMap
  private static Map viewSignups(
      HttpServletRequest req, PrintWriter out, Connection con, boolean json_mode) {

    int wait_list_id = 0;
    int wait_list_signup_id = 0;
    int sum_players = 0;
    int date = 0;
    int pos = 1;
    int time = SystemUtils.getTime(con);
    int today_date = (int) SystemUtils.getDate(con);
    int start_time = 0;
    int end_time = 0;
    int count = 0;
    int index = 0;
    int player_index = 0;
    Map waitlist_map = new HashMap();
    waitlist_map.put("options", new HashMap());
    waitlist_map.put("signups", new LinkedHashMap());

    String sindex =
        req.getParameter(
            "index"); //  index value of day (needed by Proshop_waitlist_slot when returning)
    String id = req.getParameter("waitListId"); //  uid of the wait list we are working with
    String course = (req.getParameter("course") == null) ? "" : req.getParameter("course");
    String returnCourse =
        (req.getParameter("returnCourse") == null) ? "" : req.getParameter("returnCourse");
    String sdate = (req.getParameter("sdate") == null) ? "" : req.getParameter("sdate");
    String name = (req.getParameter("name") == null) ? "" : req.getParameter("name");
    String day_name = (req.getParameter("day_name") == null) ? "" : req.getParameter("day_name");
    String sstart_time =
        (req.getParameter("start_time") == null) ? "" : req.getParameter("start_time");
    String send_time = (req.getParameter("end_time") == null) ? "" : req.getParameter("end_time");
    // String count = (req.getParameter("count") == null) ? "" : req.getParameter("count");
    String jump = req.getParameter("jump");

    String fullName = "";
    String cw = "";
    String notes = "";
    String nineHole = "";

    PreparedStatement pstmt = null;
    PreparedStatement pstmt2 = null;

    boolean tmp_found = false;
    boolean tmp_found2 = false;
    boolean master =
        (req.getParameter("view") != null && req.getParameter("view").equals("master"));
    boolean show_notes =
        (req.getParameter("show_notes") != null && req.getParameter("show_notes").equals("yes"));
    boolean alt_row = false;
    boolean tmp_converted = false;

    try {

      date = Integer.parseInt(sdate);
      index = Integer.parseInt(sindex);
      wait_list_id = Integer.parseInt(id);
      start_time = Integer.parseInt(sstart_time);
      end_time = Integer.parseInt(send_time);
    } catch (NumberFormatException e) {
    }

    try {

      count = getWaitList.getListCount(wait_list_id, date, index, time, !master, con);

    } catch (Exception exp) {
      out.println(exp.getMessage());
    }

    //
    //  isolate yy, mm, dd
    //
    int yy = date / 10000;
    int temp = yy * 10000;
    int mm = date - temp;
    temp = mm / 100;
    temp = temp * 100;
    int dd = mm - temp;
    mm = mm / 100;

    String report_date = SystemUtils.getLongDateTime(today_date, time, " at ", con);

    if (!json_mode) {
      out.println("<br>");
      out.println(
          "<h3 align=center>"
              + ((master) ? "Master Wait List Sign-up Sheet" : "Current Wait List Sign-ups")
              + "</h3>");

      out.println("<p align=center><font size=3><b><i>\"" + name + "\"</i></b></font></p>");

      out.println("<table border=0 align=center>");

      out.println("<tr><td><font size=\"2\">");
      out.println(
          "Date:&nbsp;&nbsp;<b>"
              + day_name
              + "&nbsp;&nbsp;"
              + mm
              + "/"
              + dd
              + "/"
              + yy
              + "</b></td>");
      out.println("<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</td><td>");
      if (!course.equals("")) {
        out.println("<font size=\"2\">Course:&nbsp;&nbsp;<b>" + course + "</b></font>");
      }
      out.println("</td></tr>");

      out.println(
          "<tr><td><font size=\"2\">Time:&nbsp;&nbsp;<b>"
              + SystemUtils.getSimpleTime(start_time)
              + " to "
              + SystemUtils.getSimpleTime(end_time)
              + "</b></font></td>");

      out.println("<td></td>");

      out.println("<td><font size=\"2\">Signups:&nbsp;&nbsp;<b>" + count + "</b></font></td>");

      out.println("</table>");

      out.println(
          "<p align=center><font size=2><b><i>List Generated on "
              + report_date
              + "</i></b></font></p>");

      out.println("<table align=center border=1 bgcolor=\"#F5F5DC\">");

      if (master) {

        out.println(
            "<tr bgcolor=\"#8B8970\" align=center style=\"color: black; font-weight: bold\">"
                + "<td height=35>&nbsp;Pos&nbsp;</td>"
                + "<td>Sign-up Time</td>"
                + "<td>Members</td>"
                + "<td>Desired Time</td>"
                + "<td>&nbsp;Players&nbsp;</td>"
                + "<td>&nbsp;On Sheet&nbsp;</td>"
                + "<td>Converted At</td>"
                + "<td>&nbsp;Converted By&nbsp;</td>"
                + ((show_notes) ? "<td>&nbsp;Notes&nbsp;</td>" : "")
                + "</tr>");
      } else {

        out.println(
            "<tr bgcolor=\"#8B8970\" align=center style=\"color: black; font-weight: bold\">"
                + "<td height=35>&nbsp;Pos&nbsp;</td>"
                + "<td>Members</td>"
                + "<td>Desired Time</td>"
                + "<td>&nbsp;Players&nbsp;</td>"
                + ((show_notes) ? "<td>&nbsp;Notes&nbsp;</td>" : "")
                + "</tr>"); // +
        // "<td>&nbsp;On Sheet&nbsp;</td>" +
        // "</tr>");
        // ((multi == 0) ? "" : "<td>Course</td>") +
      }
      out.println(
          "<!-- wait_list_id=" + wait_list_id + ", date=" + date + ", time=" + time + " -->");
    }

    try {

      pstmt =
          con.prepareStatement(
              ""
                  + "SELECT *, "
                  + "DATE_FORMAT(created_datetime, '%c/%e/%y %r') AS created_time, "
                  + "DATE_FORMAT(converted_at, '%c/%e/%y %r') AS converted_time "
                  + // %l:%i %p
                  "FROM wait_list_signups "
                  + "WHERE wait_list_id = ? AND date = ? "
                  + ((master) ? "" : "AND converted = 0 ")
                  + ((!master && sindex.equals("0")) ? "AND ok_etime > ? " : "")
                  + "ORDER BY created_datetime");

      pstmt.clearParameters();
      pstmt.setInt(1, wait_list_id);
      pstmt.setInt(2, date);
      if (!master && sindex.equals("0")) {
        pstmt.setInt(3, time);
      }

      ResultSet rs = pstmt.executeQuery();

      while (rs.next()) {

        wait_list_signup_id = rs.getInt("wait_list_signup_id");

        if (json_mode) {
          ((Map) waitlist_map.get("signups"))
              .put("signup_id_" + wait_list_signup_id, new LinkedHashMap());
          ((Map) ((Map) waitlist_map.get("signups")).get("signup_id_" + wait_list_signup_id))
              .put("players", new LinkedHashMap());
          ((Map) ((Map) waitlist_map.get("signups")).get("signup_id_" + wait_list_signup_id))
              .put("options", new HashMap());
        } else {
          out.print(
              "<tr align=center"
                  + ((alt_row) ? " style=\"background-color:white\"" : "")
                  + "><td>"
                  + pos
                  + "</td>");
          if (master) {
            out.println("<td>&nbsp;" + rs.getString("created_time") + "&nbsp;</td>");
          }
          out.print("<td align=left>");
        }
        // if (multi == 1) out.println("<td>" + rs.getString("course") + "</td>");

        //
        //  Display players in this signup
        //
        pstmt2 =
            con.prepareStatement(
                ""
                    + "SELECT * "
                    + "FROM wait_list_signups_players "
                    + "WHERE wait_list_signup_id = ? "
                    + "ORDER BY pos");

        pstmt2.clearParameters();
        pstmt2.setInt(1, wait_list_signup_id);

        ResultSet rs2 = pstmt2.executeQuery();

        tmp_found2 = false;
        player_index = 0;

        while (rs2.next()) {

          if (json_mode) {
            player_index++;
            ((Map)
                    ((Map)
                            ((Map) waitlist_map.get("signups"))
                                .get("signup_id_" + wait_list_signup_id))
                        .get("players"))
                .put("player_" + player_index, new HashMap());
            ((Map)
                    ((Map)
                            ((Map)
                                    ((Map) waitlist_map.get("signups"))
                                        .get("signup_id_" + wait_list_signup_id))
                                .get("players"))
                        .get("player_" + player_index))
                .put("player_name", rs2.getString("player_name"));
            ((Map)
                    ((Map)
                            ((Map)
                                    ((Map) waitlist_map.get("signups"))
                                        .get("signup_id_" + wait_list_signup_id))
                                .get("players"))
                        .get("player_" + player_index))
                .put("player_name", rs2.getString("player_name"));
            ((Map)
                    ((Map)
                            ((Map)
                                    ((Map) waitlist_map.get("signups"))
                                        .get("signup_id_" + wait_list_signup_id))
                                .get("players"))
                        .get("player_" + player_index))
                .put("cw", rs2.getString("cw"));
            ((Map)
                    ((Map)
                            ((Map)
                                    ((Map) waitlist_map.get("signups"))
                                        .get("signup_id_" + wait_list_signup_id))
                                .get("players"))
                        .get("player_" + player_index))
                .put("9hole", rs2.getInt("9hole"));
          } else {
            fullName = rs2.getString("player_name");
            cw = rs2.getString("cw");
            if (rs2.getInt("9hole") == 1) {
              cw = cw + "9";
            }
            if (tmp_found2) {
              out.print(",&nbsp; ");
            } else {
              out.print("&nbsp;");
            }
            out.print(fullName + " <font style=\"font-size:9px\">(" + cw + ")</font>");
            tmp_found2 = true;
          }
          sum_players++;
          nineHole = ""; // reset
        }

        pstmt2.close();

        if (json_mode) {

          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("notes", notes);
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("created_time", rs.getInt("created_time"));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("converted", rs.getInt("converted"));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("converted_time", rs.getString("converted_time"));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("converted_by", rs.getString("converted_by"));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("start_time", SystemUtils.getSimpleTime(rs.getInt("ok_stime")));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("end_time", SystemUtils.getSimpleTime(rs.getInt("ok_etime")));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("wait_list_signup_id", wait_list_signup_id);
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("player_count", sum_players);
        } else {
          out.print("</td>");
          out.println(
              "<td>&nbsp;"
                  + SystemUtils.getSimpleTime(rs.getInt("ok_stime"))
                  + " - "
                  + SystemUtils.getSimpleTime(rs.getInt("ok_etime"))
                  + "&nbsp;</td>");
          out.println("<td>" + sum_players + "</td>");

          if (master) {

            tmp_converted = rs.getInt("converted") == 1;
            out.println("<td>" + ((tmp_converted) ? "Yes" : "No") + "</td>");
            out.println(
                "<td>" + ((tmp_converted) ? rs.getString("converted_time") : "&nbsp;") + "</td>");
            out.println(
                "<td>" + ((tmp_converted) ? rs.getString("converted_by") : "&nbsp;") + "</td>");
          }

          if (show_notes) {

            notes = rs.getString("notes").trim();
            if (notes.equals("")) {
              notes = "&nbsp;";
            }
            out.println("<td>" + notes + "</td>");
          }

          out.print("</tr>");
        }

        pos++;
        sum_players = 0;
        alt_row = alt_row == false;
      }

      pstmt.close();

    } catch (Exception exc) {

      SystemUtils.buildDatabaseErrMsg(
          "Error loading wait list signups.", exc.toString(), out, false);
    }

    if (json_mode) {

      ((Map) waitlist_map.get("options")).put("index", sindex);
      ((Map) waitlist_map.get("options")).put("wait_list_id", wait_list_id);
      ((Map) waitlist_map.get("options")).put("date", "" + mm + "/" + dd + "/" + yy);
      ((Map) waitlist_map.get("options")).put("name", name);
      ((Map) waitlist_map.get("options")).put("time", time);
      ((Map) waitlist_map.get("options")).put("jump", jump);
      ((Map) waitlist_map.get("options")).put("returnCourse", returnCourse);
      ((Map) waitlist_map.get("options")).put("course", course);
      ((Map) waitlist_map.get("options")).put("master", master);
      ((Map) waitlist_map.get("options")).put("report_date", report_date);
      ((Map) waitlist_map.get("options")).put("show_notes", show_notes);

    } else {

      out.println("</table><br>");

      out.println("<table align=center><tr>");

      out.println("<form action=\"Member_jump\" method=\"POST\" target=\"_top\">");
      out.println("<input type=\"hidden\" name=\"jump\" value=\"0\">");
      out.println("<input type=\"hidden\" name=\"index\" value=" + sindex + ">");
      out.println(
          "<input type=\"hidden\" name=\"course\" value=\""
              + ((!returnCourse.equals("")) ? returnCourse : course)
              + "\">");

      out.println("<td><input type=\"submit\" value=\"Tee Sheet\"></td></form>");

      out.println("<td>&nbsp;&nbsp;</td>");

      out.println("<form action=\"Member_waitlist\" method=\"POST\">");
      out.println("<input type=\"hidden\" name=\"waitListId\" value=\"" + wait_list_id + "\">");
      out.println("<input type=\"hidden\" name=\"date\" value=\"" + date + "\">");
      out.println("<input type=\"hidden\" name=\"day\" value=\"" + day_name + "\">");
      out.println("<input type=\"hidden\" name=\"index\" value=\"" + sindex + "\">");
      out.println("<input type=\"hidden\" name=\"course\" value=\"" + course + "\">");
      out.println("<input type=\"hidden\" name=\"returnCourse\" value=\"" + returnCourse + "\">");
      out.println("<input type=\"hidden\" name=\"jump\" value=\"" + jump + "\">");

      out.println("<td><input type=\"submit\" value=\"Return\"></td></form>");

      out.println("</tr></table></form>");

      out.println("<br>");
    }

    return waitlist_map;
  } // end viewSignups
Exemple #12
0
  // *****************************************************
  // Process the request from Member_sheet
  // *****************************************************
  //
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    PreparedStatement pstmt3 = null;
    Statement stmt = null;
    ResultSet rs = null;

    HttpSession session = SystemUtils.verifyMem(req, out); // check for intruder

    if (session == null) {

      return;
    }

    Connection con = SystemUtils.getCon(session); // get DB connection

    if (con == null) {

      out.println(SystemUtils.HeadTitle("DB Connection Error"));
      out.println(
          "<BODY bgcolor=\"#ccccaa\"><CENTER><img src=\"/" + rev + "/images/foretees.gif\"><BR>");
      out.println("<hr width=\"40%\">");
      out.println("<BR><BR><H3>Database Connection Error</H3>");
      out.println("<BR><BR>Unable to connect to the Database.");
      out.println("<BR>Please try again later.");
      out.println("<BR><BR>If problem persists, please contact customer support.");
      out.println("<BR><BR>");
      out.println("<font size=\"2\">");
      out.println("<form method=\"get\" action=\"javascript:history.back(1)\">");
      out.println("<input type=\"submit\" value=\"Return\" style=\"text-decoration:underline;\">");
      out.println("</form></font>");
      out.println("</CENTER></BODY></HTML>");
      out.close();
      return;
    }

    // Create Json response for later use
    Gson gson_obj = new Gson();
    // HashMap for later use by gson
    Map<String, Object> hashMap = new HashMap<String, Object>();
    // Check if we will only be return json data
    boolean json_mode = (req.getParameter("jsonMode")) != null;

    //
    // See if we are here to VIEW a wait list
    //
    if (req.getParameter("view") != null && req.getParameter("waitListId") != null) {

      if (json_mode) {
        out.print(gson_obj.toJson(viewSignups(req, out, con, true)));
      } else {
        viewSignups(req, out, con);
      }
      return;
    }

    String jump = "0"; // jump index - default to zero (for _sheet)

    if (req.getParameter("jump") != null) { // if jump index provided

      jump = req.getParameter("jump");
    }

    //
    //  Get this session's username
    //
    String club = (String) session.getAttribute("club");
    String user = (String) session.getAttribute("user");
    String name = (String) session.getAttribute("name"); // get users full name

    String sindex =
        req.getParameter("index"); //  index value of day (needed by Member_sheet when returning)
    String course = req.getParameter("course"); //  Name of Course
    String id = req.getParameter("waitListId"); //  uid of the wait list we are working with

    String returnCourse = "";

    if (req.getParameter("returnCourse") != null) { // if returnCourse provided

      returnCourse = req.getParameter("returnCourse");
    }

    String sdate = req.getParameter("date"); //  date of the request (yyyymmdd)
    String day_name = req.getParameter("day"); //  name of the day
    String p5 = req.getParameter("p5"); //  5-somes supported

    int index = 0;
    int wait_list_id = 0;
    int count = 0;

    int mm = 0;
    int dd = 0;
    int yy = 0;
    int date = 0;

    int time = SystemUtils.getTime(con);

    //
    //  Convert the values from string to int
    //
    try {

      wait_list_id = Integer.parseInt(id);
      index = Integer.parseInt(sindex);
      date = Integer.parseInt(sdate);
    } catch (NumberFormatException e) {
    }

    // get our date parts
    yy = date / 10000;
    mm = date - (yy * 10000);
    dd = mm - (mm / 100) * 100;
    mm = mm / 100;

    //
    //  parm block to hold the wait list parameters
    //
    parmWaitList parmWL = new parmWaitList(); // allocate a parm block

    parmWL.wait_list_id = wait_list_id;

    try {

      getWaitList.getParms(con, parmWL); // get the wait list config

      // if members can see the wait list then get the count
      if (parmWL.member_view == 1) {
        count = getWaitList.getListCount(wait_list_id, date, index, time, true, con);
      }

    } catch (Exception exp) {
      out.println(exp.getMessage());
    }

    int onlist = 0;

    try {

      onlist = getWaitList.onList(user, wait_list_id, date, con);

    } catch (Exception exp) {

      out.println(exp.toString());
    }

    String waitlist_notice = "";

    if (onlist == 0) {

      // not on the list

      try {

        // out.println("<pre>");
        waitlist_notice = getWaitList.getNotice(wait_list_id, con);
        // out.println("</pre>");

      } catch (Exception exp) {
      }
    }

    if (json_mode) {

      // If in json mode, add data to hashmap
      // New skin uses Member_waitlist in json mode exclusively.

      // Group the data we want to send to javascript in a hash map
      hashMap.put("wait_list_id", wait_list_id);
      hashMap.put("waitlist_notice", waitlist_notice);
      hashMap.put("date", "" + mm + "/" + dd + "/" + yy);
      hashMap.put("start_time", SystemUtils.getSimpleTime(parmWL.start_time));
      hashMap.put("end_time", SystemUtils.getSimpleTime(parmWL.end_time));
      hashMap.put("member_access", parmWL.member_access);
      hashMap.put("member_view", parmWL.member_view);
      hashMap.put("onlist", onlist);
      hashMap.put("index", index);
      hashMap.put("course", course);
      hashMap.put("count", count);
      hashMap.put("name", parmWL.name);

      out.print(gson_obj.toJson(hashMap));

      return;

    } else {
      // If not in json mode, output data directly to user

      out.println(
          "<!-- wait_list_id=" + wait_list_id + ", date=" + date + ", count=" + count + " -->");

      //
      // ********************************************************************
      //   Build a page to display Wait List details to member
      // ********************************************************************
      //
      out.println("<html>");
      out.println("<head>");
      out.println(
          "<link rel=\"stylesheet\" href=\"/"
              + rev
              + "/web utilities/foretees2.css\" type=\"text/css\">");
      out.println("<title>Member Wait List Registration Page</title>");
      out.println("</head>");

      out.println(
          "<body bgcolor=\"#ccccaa\" text=\"#000000\" link=\"#FFFFFF\" vlink=\"#FFFFFF\" alink=\"#FF0000\" topmargin=\"0\">");
      out.println("<font face=\"Arial, Helvetica, Sans-serif\"><center>");

      out.println(
          "<table border=\"0\" width=\"100%\" align=\"center\" valign=\"top\">"); // large table for
                                                                                  // whole page
      out.println("<tr><td valign=\"top\" align=\"center\">");

      out.println(
          "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#336633\" align=\"center\" valign=\"top\">");
      out.println("<tr><td align=\"left\" width=\"300\">&nbsp;");
      out.println("<img src=\"/" + rev + "/images/foretees.gif\" border=0>");
      out.println("</td>");

      out.println("<td align=\"center\">");
      out.println("<font color=\"ffffff\" size=\"5\">Member Wait List Registration</font>");
      out.println("</font></td>");

      out.println("<td align=\"center\" width=\"300\">");
      out.println("<font size=\"1\" color=\"#ffffff\">Copyright&nbsp;</font>");
      out.println("<font size=\"2\" color=\"#ffffff\">&#169;&nbsp;</font>");
      out.println(
          "<font size=\"1\" color=\"#ffffff\">ForeTees, LLC <br> 2009 All rights reserved.");
      out.println("</font><font size=\"3\">");
      out.println(
          "<br><br><a href=\"/" + rev + "/member_help.htm\" target=\"_blank\"><b>Help</b></a>");
      out.println("</font></td>");
      out.println("</tr></table>");

      out.println("<br>");

      out.println("<table border=\"1\" cols=\"1\" bgcolor=\"#f5f5dc\" cellpadding=\"3\">");
      out.println("<tr>");
      out.println("<td width=\"620\" align=\"center\">");
      out.println("<font size=\"3\">");
      out.println("<b>Wait List Registration</b><br></font>");
      out.println("<font size=\"2\">");

      out.println(
          "The golf shop is running a wait list "
              + ((index == 0) ? "today" : "on this day")
              + ". ");
      out.println(
          "The wait list you've selected is running from <nobr>"
              + SystemUtils.getSimpleTime(parmWL.start_time)
              + "</nobr> till <nobr>"
              + SystemUtils.getSimpleTime(parmWL.end_time)
              + ".</nobr> ");

      out.println("Review the information below and click on 'Continue With Request' to continue.");
      out.println(
          "<br>OR click on 'Cancel Request' to delete the request. To return without changes click on 'Go Back'.");

      // out.println("<br><br><b>NOTE:</b> Only the person that originates the request will be
      // allowed to cancel it or change these values.");

      out.println("</font></td></tr>");
      out.println("</table>");

      out.println("<br><br>");

      out.println("<table border=0>");

      out.println("<tr><td><font size=\"2\">");
      out.println(
          "Date:&nbsp;&nbsp;<b>"
              + day_name
              + "&nbsp;&nbsp;"
              + mm
              + "/"
              + dd
              + "/"
              + yy
              + "</b></td>");
      out.println("<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</td><td>");
      if (!course.equals("")) {
        out.println("<font size=\"2\">Course:&nbsp;&nbsp;<b>" + course + "</b></font>");
      }
      out.println("</td></tr>");

      out.println(
          "<tr><td><font size=\"2\">Wait List:&nbsp;&nbsp;<b>"
              + SystemUtils.getSimpleTime(parmWL.start_time)
              + " to "
              + SystemUtils.getSimpleTime(parmWL.end_time)
              + "</b></font></td>");

      out.println("<td></td>");

      out.println("<td><font size=\"2\">Signups:<b>");
      out.print(((parmWL.member_view == 1) ? count : "N/A"));
      out.println("</b></font></td>");

      out.println("</table>");

      out.println("<br>");

      out.println("<table border=\"0\" align=\"center\">"); // table to contain 2 tables below

      out.println("<tr>");

      out.println("<td align=\"center\" valign=\"top\">");

      out.println(
          "<table border=\"1\" bgcolor=\"#f5f5dc\" align=\"center\" width=\"500\" cellpadding=\"5\" cellspacing=\"5\">"); // table for request details
      out.println("<tr bgcolor=\"#336633\"><td align=\"center\">");
      out.println("<font color=\"ffffff\" size=\"3\">");
      out.println(
          "<b>" + ((!parmWL.name.equals("")) ? parmWL.name : "Wait List Information") + "</b>");
      out.println("</font></td></tr>");

      out.println("<tr>");

      out.println("<form action=\"Member_waitlist_slot\" method=\"post\">");
      out.println("<input type=\"hidden\" name=\"waitListId\" value=\"" + wait_list_id + "\">");
      out.println("<input type=\"hidden\" name=\"sdate\" value=\"" + date + "\">");
      out.println("<input type=\"hidden\" name=\"day\" value=\"" + day_name + "\">");
      out.println("<input type=\"hidden\" name=\"index\" value=\"" + sindex + "\">");
      out.println("<input type=\"hidden\" name=\"course\" value=\"" + course + "\">");
      out.println("<input type=\"hidden\" name=\"returnCourse\" value=\"" + returnCourse + "\">");
      out.println("<input type=\"hidden\" name=\"jump\" value=\"" + jump + "\">");

      out.println("<td><font size=\"2\"><br>");

      // see if they are already on the wait list
      out.println("<input type=\"hidden\" name=\"signupId\" value=\"" + onlist + "\">");

      if (onlist == 0) {

        // not on the list

        // out.println("The golf shop is running a wait list " + ((index == 0) ? "today": "on this
        // day") + ". ");
        // out.println("The wait list you've selected is running from " +
        // SystemUtils.getSimpleTime(parmWL.start_time) + " till " +
        // SystemUtils.getSimpleTime(parmWL.end_time) + ". ");

        // try {

        // out.println("<pre>");
        // out.print(getWaitList.getNotice(wait_list_id, con));
        // out.println("</pre>");
        out.print(waitlist_notice);

        // } catch (Exception exp) { }

        if (parmWL.member_access == 1) {
          out.println(
              "<br><p align=center><input type=submit value=\"Continue With Sign-up\" name=\"continue\"></p>");
        } else {
          out.println("<p align=center><b>Contact the golf shop to get on the wait list.</b></p>");
        }

      } else {

        // already on this list

        out.println(
            "<p align=center><b><i>You are already signed up for this wait list.</b></i></p>");

        if (parmWL.member_access == 1) {
          out.println(
              "<br><p align=center><input type=submit value=\"Modify Your Sign-up\" name=\"continue\"></p>");
        } else {
          out.println(
              "<p align=center><b>Contact the golf shop to make changes or cancel your entry.</b></p>");
        }
      }

      if (parmWL.member_view == 1 && count > 0) {

        out.println(
            "<p align=center><input type=button value=\"View Wait List\" name=\"view\" onclick=\"document.forms['frmView'].submit();\"></p>");
      }

      out.println("<br></font></td>");

      out.println("</table>");
      out.println("</form>");

      out.println("<br>");

      if (index == 999) {

        // out.println("<form action=\"Member_teelist\" method=\"GET\">");
        out.println("<form action=\"/" + rev + "/member_teemain.htm\" method=\"GET\">");

      } else if (index == 995) {

        // out.println("<form action=\"Member_teelist_list\" method=\"GET\">");
        out.println("<form action=\"/" + rev + "/member_teemain2.htm\" method=\"GET\">");

      } else {

        out.println("<form action=\"Member_jump\" method=\"POST\">");
        out.println("<input type=\"hidden\" name=\"jump\" value=" + jump + ">");
        out.println("<input type=\"hidden\" name=\"index\" value=" + index + ">");
        out.println(
            "<input type=\"hidden\" name=\"course\" value=\""
                + ((!returnCourse.equals("")) ? returnCourse : course)
                + "\">");
      }
      out.println("<font size=2>Return w/o Changes:</font><br>");
      out.println("<input type=\"submit\" value=\"Go Back\" name=\"cancel\"></form>");

      out.println("<form action=\"Member_waitlist\" method=\"GET\" name=frmView>");
      out.println("<input type=\"hidden\" name=\"view\" value=\"current\">");
      out.println("<input type=\"hidden\" name=\"waitListId\" value=\"" + wait_list_id + "\">");
      out.println("<input type=\"hidden\" name=\"sdate\" value=\"" + date + "\">");
      out.println("<input type=\"hidden\" name=\"name\" value=\"" + parmWL.name + "\">");
      // out.println("<input type=\"hidden\" name=\"day\" value=\"" + day_name + "\">");
      out.println("<input type=\"hidden\" name=\"index\" value=\"" + sindex + "\">");
      out.println("<input type=\"hidden\" name=\"course\" value=\"" + parmWL.course + "\">");
      out.println("<input type=\"hidden\" name=\"returnCourse\" value=\"" + returnCourse + "\">");
      out.println("<input type=\"hidden\" name=\"jump\" value=\"" + jump + "\">");
      ;
      out.println(
          "<input type=\"hidden\" name=\"start_time\" value=\"" + parmWL.start_time + "\">");
      out.println("<input type=\"hidden\" name=\"end_time\" value=\"" + parmWL.end_time + "\">");
      out.println("<input type=\"hidden\" name=\"day_name\" value=\"" + day_name + "\">");
      // out.println("<input type=submit value=\"View Sign-ups\" name=\"view\">");
      out.println("</form>");
    } // end json check
  } // end doPost
  private void doUpdate(PrintWriter out) {

    Connection con1 = null; // init DB objects
    Connection con2 = null;
    PreparedStatement pstmt = null;
    Statement stmt1 = null;
    Statement stmt1a = null;
    Statement stmt2 = null;
    Statement stmt3 = null;
    ResultSet rs1 = null;
    ResultSet rs2 = null;
    ResultSet rs3 = null;

    out.println("<HTML><HEAD><TITLE>Database Query</TITLE></HEAD>");
    out.println("<BODY><H3>Starting Job to Check for Clubster Users</H3>");
    out.flush();

    String club = "";
    String name = "";

    try {

      con1 = dbConn.Connect(rev);
    } catch (Exception exc) {

      // Error connecting to db....
      out.println("<BR><BR>Unable to connect to the DB.");
      out.println("<BR>Exception: " + exc.getMessage());
      out.println("<BR><BR> <A HREF=\"/v5/servlet/Support_main\">Return</A>.");
      out.println("</BODY></HTML>");
      return;
    }

    //
    // Get the club names from the 'clubs' table
    //
    //  Process each club in the table
    //
    int x1 = 0;
    int x2 = 0;
    int i = 0;

    boolean skip = true;

    try {

      stmt1 = con1.createStatement();
      rs1 = stmt1.executeQuery("SELECT clubname, fullname FROM clubs ORDER BY clubname");

      while (rs1.next()) {

        x1++;
        club = rs1.getString(1); // get a club name
        name = rs1.getString(2); // get full club name

        con2 = dbConn.Connect(club); // get a connection to this club's db

        stmt2 = con2.createStatement();

        rs2 = stmt2.executeQuery("SELECT date FROM sessionlog WHERE msg LIKE '%clubster'");

        if (rs2.next()) {

          out.println("<br><br>");
          out.print("Club found: " + club + ", " + name);
        }

        stmt2.close();
        con2.close();
      }

      stmt1.close();
      con1.close();

    } catch (Exception e) {

      // Error connecting to db....

      out.println("<BR><BR><H3>Fatal Error!</H3>");
      out.println("Error performing update to club '" + club + "'.");
      out.println("<BR>Exception: " + e.getMessage());
      out.println("<BR>Message: " + e.toString());
      out.println("<BR><BR> <A HREF=\"/v5/servlet/Support_main\">Return</A>.");
      out.println("</BODY></HTML>");
      out.close();
      Connect.close(stmt2, con2);
      Connect.close(stmt1, con1);
      return;
    }

    Connect.close(stmt2, con2);
    Connect.close(stmt1, con1);

    out.print("<BR><BR>Done, " + x1 + "clubs checked.");
    out.println("<BR><BR> <A HREF=\"/v5/servlet/Support_main\">Return</A>");
    out.println("</CENTER></BODY></HTML>");
    // out.flush();
    // out.close();

  }