%@ page language="java"
import="java.sql.*, java.io.*, java.util.*, users.databases.*"
%>
<%!
/***** METHOD DECLARATION *****/
/*** function FOUND-EMPTY-BOX checks for null entry or empty textbox ***/
boolean foundEmptyBox (String strBoxValue) {
boolean found = false;
if (strBoxValue.equals("")) {
found = true;
}
return found;
}
%>
<%
/**** VARIABLE DECLARATION and INITIALIZATION *****/
boolean withError = true;
byte bytStatus = 0;
String strPwd2 = "", strEMail2 = "";
String strTempDB = "product_tmpClientInfoDB";
String strMainDB = "product_pgpClientInfoDB";
String strUserLogName = request.getParameter("userLogName");
String strPwd1 = request.getParameter("userPwd");
String strEMail1 = request.getParameter("userEMail");
String strWhatDB = request.getParameter("whatDB"); // WHAT DATABASE TO USE, VALUES = { mainDB, tempDB } = pgpClientInfoDB, tmpClientInfoDB respectively
String strFirstTimer = request.getParameter("userFirstTime");
int intErrCounter = Integer.parseInt(request.getParameter("errorCounter"));
/***** MAIN *****/
strEMail1 = strEMail1.toLowerCase();
if (strWhatDB.equals("mainDB")) {
users.connect(strMainDB);
} else {
users.connect(strTempDB);
}
String SQLstmt = "SELECT Usr_Pwd, ApplicLvlStatus FROM tblUserPwd WHERE Usr_LogName=\"" + strUserLogName + "\";";
ResultSet rs = users.listQuery(SQLstmt);
while (rs.next()) {
strPwd2 = rs.getString("Usr_Pwd");
bytStatus = rs.getByte("ApplicLvlStatus");
}
if (bytStatus==1) {
users.disconnect();
if (strPwd1.equals(strPwd2)) {
withError = false;
}
} else {
SQLstmt = "SELECT Usr_EMail FROM tblUserPwd JOIN tblUserInfo WHERE Pwd_ID=Usr_ID AND Usr_LogName=\"" + strUserLogName + "\";";
rs = users.listQuery(SQLstmt);
while (rs.next()) {
strEMail2 = rs.getString("Usr_EMail");
}
users.disconnect();
if (strPwd1.equals(strPwd2)) {
if (strEMail1.equals(strEMail2)) {
withError = false;
}
}
}
%>
User Verification
<% if (bytStatus != 1) { %>
<% } else { %>
<% } %>
<% if (withError) { %>
<% if (intErrCounter==3) { %>
<% } else { %>
<% intErrCounter++; %>
<% if (bytStatus==1) { %>
The password you entered is invalid! Please enter the password you registered before.
<% } else if (strFirstTimer.equals("true")) { %>
Please fill up the following:
<% } else { %>
Either the PASSWORD or EMAIL ADDRESS you entered is invalid OR BOTH. Please check if you entered the same values when you registered with us previously.