- * RegLoginServletHW3.java
- *
- * Created on October 17, 2007, 10:29 PM
- */
- package ITIS5166;
- import java.io.*;
- import java.net.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import java.util.*;
- import java.util.regex.*;
- /**
- *
- * @author Administrator
- * @version
- */
- public class RegLoginServletHW3 extends HttpServlet {
- private Hashtable users;//Info = new Hashtable();
- protected void doGet(HttpServletRequest request,
- HttpServletResponse response)
- throws ServletException, IOException {
- String username = "";
- String password = "";
- String passwordConfirm = "";
- String usernameError = "";
- String passwordError = "";
- String passwordConfError = "";
- if (users == null) {
- users = new Hashtable();
- }
- HttpSession session = request.getSession();
- String sessionUser = (String) session.getAttribute("user");
- if (sessionUser != null){
- session.invalidate();
- } else {
- username = (String) request.getParameter("user");
- password = (String) request.getParameter("password");
- passwordConfirm = (String) request.getParameter("confpass");
- if (username == null && password == null && passwordConfirm == null) {
- //the first time the page has been display
- }
- else if ( username == null || username.length() == 0) {
- usernameError = "<tr class=\"content error\"><td colspan=\"2\"> Error: Please Enter a username</td></tr>\n";
- } else if (password == null || password.length() ==0) {
- passwordError = "<tr class><td colspan=2> Error: Please enter a password</td></tr>\n";
- } else {
- username = HTMLFilter(username);
- if (users.containsKey(username)) {
- String storedPassword = (String) users.get(username);
- if (storedPassword.equals(password)) {
- session.setAttribute("user", username);
- response.sendRedirect("CatSerlvetHW3");
- } else {
- if (passwordConfirm !=null && passwordConfirm.length() > 0) {
- usernameError = "<tr><td colspan=\"2\">Error: username already in use</td></tr>\n";
- } else {
- passwordError = "<tr><td colspan=\"2\">Error: Incorrect password</td></tr>\n";
- }
- }
- } else {
- if (passwordConfirm == null || ! password.equals(passwordConfirm)) {
- passwordConfError = "<tr><td colspan=\"2\">Error: Passwords do not match</td></tr>\n";
- } else {
- session.setAttribute("user", username);
- users.put(username,password);
- response.sendRedirect("CatServletHW3");
- }
- }
- }
- }
- if (username == null) {username = "";}
- response.setContentType("text/html; charset=UTF-8");
- PrintWriter out = response.getWriter();
- String title = "Login/Register";
- String docType =
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
- "Transitional//EN\">\n";
- out.println(docType +
- "<HTML>\n" +
- "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
- "<BODY BGCOLOR=\"#FDF5E6\">\n" +
- "<form action= \"\" method=\"post\">\n" +
- "<table border=\"1\">\n" +
- "<tr><td colspan=\"2\"> Login/Register\n" +
- "Account Information</td></tr>\n" +
- usernameError +
- "<tr><td> Request Username:</td>\n" +
- "<td><input type=\"text\"\n" +
- "name=\"user\" value=\"" + username + "\"/> </td></tr>\n"+
- passwordError+
- "<tr><td> Password:</td>\n" +
- "<td><input type =\"password\"\n"+
- "name=\"pass\" /></td></tr> \n" +
- "<tr><td colspan\"2\"> For New Account ,\n" +
- "Confirm Password</td><tr>\n" +
- "passwordConfError +" +
- "<tr><td>Password:</td>\n" +
- "name=\"confpass\" /> </td></tr>\n" +
- "<tr><td=\"2\">\n" +
- "<input type=\"submit\"\n" +
- "value=\"Submit\" />\n" +
- "<input type=\"reset\"\n" +
- "value=\"Reset\" /></td></tr>\n" +
- "</table>\n" +
- "</form> \n " +
- "</body> \n" +
- "</html> \n");
- }
- protected void doPost(HttpServletRequest request,
- HttpServletResponse response)
- throws ServletException, IOException {
- doGet(request, response);
- }
- public static String HTMLFilter(String input){
- String regex[] = {"&","<",">","\""};
- String replace[] = {"&", "<", ">", """};
- Matcher m;
- String newString = "";
- String s = input;
- for (int i = 0; 1 < 4; i++) {
- m = Pattern.compile(regex[i]).matcher(s);
- newString = (m.find() ? m.replaceAll(replace[i]) : s);
- s = newString;
- }
- return newString;
- //} else {
- // return input;
- //}
- }
- }
viagra mexico sildenafil 5 mg tablet viagra medicine price
cephalexin treat chlamydia keflex dosage and duration for skin infection is cephalexin good for abscess tooth
cephalexin for e coli cephalexin every 6 hours can you take keflex if allergic to sulfa
is cephalexin the same as ciprofloxacin keflex and marijuana allergic to keflex can i take sulfamethoxazole
can i give my baby amoxicillin and tylenol at the same time amoxicillin for tooth pain amoxicillin and birth control
amoxicillin for covid patients amoxicillin dosage for tooth infection how many days amoxicillin for gallbladder infection
prednisone immunosuppressive prednisone 20 mg para que es prednisone for dogs dosage
what is ciprofloxacin for ciprofloxacin nausea ciprofloxacin pink eye
doxycycline where to buy doxycycline brand name doxycycline hyclate 100mg for sinus infection
ciprofloxacin and headaches can you drink while taking ciprofloxacin ciprofloxacin dog medicine
azithromycin while breastfeeding azithromycin for gastroenteritis what is azithromycin 250 mg
viagra how to get a prescription buy viagra express sildenafil prescription australia
buying cialis generic how to increase effects of cialis tadalafil forum
female viagra online pharmacy generic viagra 100mg best price sildenafil generic india
essay transitions argumentative essay topics 2020 essay writers for hire
self evaluation sample essay essay harvard three paragraph essay
help with an essay academic essay writers custom essay writing help
professional essay help sat essay writing help help me write my essay
professional essay writer cheapest custom essay writing how to write a narrative essay step by step
best writing service homework essay help standard essay format
buy college essays persuasive essay help how to create an outline for an essay
apa essay example someone write my essay for me essay help service
narrative essay example self evaluation sample essay custom essay services
certified online pharmacy viagra boots pharmacy codeine xenical malaysia pharmacy
overseas pharmacy soma motion sickness target pharmacy wellbutrin price
oxycodone cost pharmacy fry’s food store pharmacy best online pharmacy lortab
sildenafil citrate online pharmacy rx crossroads pharmacy refill online pharmacy not requiring prescription
international pharmacy vicodin flagyl pharmacy cheap online pharmacy
lamotrigine target pharmacy online us pharmacy no prescription tramadol nexium indian pharmacy
no prescription required pharmacy rx pharmacy near me online pharmacy dubai
Sporanox pharmacy rx one med rx online pharmacy
cvs otc tadalafil prices tadalafil metabolism tadalafil 30ml x 20mg
tadalafil cialis 5mg tadalafil for gym tadalafil tablet uses
tadalafil dapoxetine 40mg 60mg how much tadalafil can i take tadalafil (cialis
adcirca tadalafil 20mg tadalafil black rx tadalafil
sildenafil 100mg vs tadalafil 20mg combining tadalafil and sildenafil when to take tadalafil for best results
ziphealth tadalafil reviews tadalafil from purchase peptides dosage tadalafil 10 mg daily
tadalafil similares tadalafil coupon cvs tadalafil vs sildenafil
avanafil vs tadalafil tadalafil highest dose tadalafil and sildenafil difference
is tadalafil stronger than viagra vidalista tadalafil 20 mg tadalafil interaction with lisinopril
tadalafil (cl) tabs tadalafil 20 mg review tadalafil mexico
tadalafil online pharmacy tadalafil tolerance tadalafil for working out