%@ page import="java.util.*, java.net.*, java.sql.*, com.netdive.billing.*, com.netdive.qanda.*" %>
<%
int accountID = Qanda.getAccountIDSBS(request.getCookies());
%>
Password Recovery
<%
String error = "";
boolean sent = false;
if (request.getParameter("lost_password") != null) {
try {
String email = request.getParameter("email");
if (email.indexOf("@") < 0) {
error = Localization.getErrorMsg("not_correct_email_address");
}
else {
Connection con = DBManager.getConnection();
String sql = "SELECT a.Account_ID, c.Company_ID FROM Companies c, Customer_Accounts a WHERE (c.Email=? OR c.Email LIKE ? OR c.Email LIKE ? OR c.Email LIKE ?) AND c.Deleted=? AND (a.Account_Type=? OR Account_Type=?) AND a.Company_ID=c.Company_ID";
PreparedStatement ps = con.prepareStatement(sql);
ps.setString(1, email);
ps.setString(2, email + ",%");
ps.setString(3, "%," + email + ",%");
ps.setString(4, "%," + email);
ps.setInt(5,0);
ps.setInt(6,8);
ps.setInt(7,9);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
System.out.println(" " + rs.getInt("Company_ID") + " " + rs.getInt("Account_ID"));
Qanda.sendCustomerCodeAccount(rs.getInt("Company_ID"),rs.getInt("Account_ID"));
sent = true;
}
else {
error = Localization.getErrorMsg("not_existing_customer");
}
}
} catch (Exception ex) {
ex.printStackTrace();
error = Localization.getErrorMsg("not_existing_customer");
}
}
if (sent) {
%> <%@ include file="nav/nav-login.inc" %>
|
| |
Password Recovery
| |
|
Your login
name and password has been
successfuly sent to your email address.
|
| |
[Back
to Home Page]
|
 |
<%@ include file="nav/cs_right.inc"%> |
<%@ include file="nav/copyright.inc" %>
<% return; }
if (!error.equals("")) { %><%@ include file="nav/nav-login.inc" %>
<%@ include file="nav/copyright.inc" %>