res.callPage(successpage, req);
}
return;
} // end login
// change user password based on cookie values for username and password
// new password is found in the parameters for the request stream
if (action.equals("changepassword")) {
String newPassword = req.getParameter("password1");
String newPasswordAgain = req.getParameter("password2");
if (!newPassword.equals(newPasswordAgain)) {
raiseError("Passwords \"" + newPassword + "\" and \"" + newPasswordAgain +
"\" do not match", failurepage, req, res);
} else {
Hashtable errors = new Hashtable();
errors = validatePassword(newPassword, errors);
if (!errors.isEmpty()) {
raiseError(toString(errors), failurepage, req, res);
} else {
String username = getUsername(session);
String password = getPassword(session);
if (!passwordsMatch(username, password)) {
uidPwdError(username, password, failurepage, req, res);
} else {
String sqlStmt = "update userverify set password= " + newPassword +
"  where username= " + username + " ";
Statement stmt = con.createStatement();
int rs = stmt.executeUpdate(sqlStmt);
stmt.close();
if (rs != 1) {
raiseError("USERVERIFYUPDATE: result rows !=1 from " + sqlStmt,
failurepage, req, res);
}
// update password cookie
session.putValue("password", newPassword);
res.callPage(successpage, req);
}
}
}
return;
} // end changepassword
// register with info provided as parameters in request stream
if (action.equals("register") || action.equals("registration")) {
String username = getUsername(req);
if (usernameExists(username)) {
raiseError("Username  " + username + "  already exists. Please try again",
failurepage, req, res);
}
Hashtable errors = validateData(req);
errors = validateUsername(username, errors);
String password = getPassword(req);
errors = validatePassword(password, errors);
if (!errors.isEmpty()) {
raiseError("The following error(s) have been detected.
Please correct and
try again:

" + toString(errors), failurepage, req, res);

} else {
Statement stmt = con.createStatement();
// insert userinfo
String sqlStmt = "insert into userinfo (first_name, last_name,
email_address, date_joined, birth_date, address, username) values ( " +
req.getParameter("first_name") + " , " + req.getParameter("last_name") + " , " +
req.getParameter("email_address") + " ,current date,date( " +
req.getParameter("birth_date") + " ), " + req.getParameter("address") + " , " + username
+ " )";
152
Linux Web Hosting with WebSphere, DB2, and Domino




  

Home

About Services Network Support FAQ Order Contact
 

Linux Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved