Cybermoola Payment Technology | Back to Previous Page
import java.io.*;
import java.util.*;
import java.net.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.cybermoola.*;
public class yahoo extends HttpServlet {
private String
m_UnPErrorP1 = "ErrorP1";
private String
m_UnPErrorP2 = "ErrorP2";
private String
m_UnPErrorP3 = "ErrorP3";
private String
m_IFErrorP1 = "IErrorP1";
private String
m_IFErrorP2 = "IErrorP2";
//private String
m_IFErrorP3 = "IErrorP3";
private String
strConfPage = "ConfPage";
private String
strConfcmPage = "ConfcmPage";
//private String
strShipCmInfo = "ShipInfo";
private String
m_EmailBody = "EmailBody";
private String
errStr = "";
private String
wmer_id = "w72";
public void
init(ServletConfig config) throws ServletException {
super.init(config);
try{
BufferedReader
in = new BufferedReader(new
FileReader("/html/cra/myff/myUserAndPin.html.dat"));
String
line="", page = "";
while((line =
in.readLine()) != null) page += line + "\n";
int
endOfFirstPart = page.indexOf("<INSERT ERROR HERE>");
int
hiddenStart =
page.indexOf("<INSERT HIDDEN>", endOfFirstPart);
int hiddenEnd = hiddenStart + 15;
m_UnPErrorP1 =
page.substring(0,endOfFirstPart);
m_UnPErrorP2 =
page.substring(endOfFirstPart+19, hiddenStart);
m_UnPErrorP3 =
page.substring(hiddenEnd, page.length());
in.close();
in = new BufferedReader(new
FileReader("/html/cra/myff/myInsuffFunds.html.dat"));
page =
"";
line="";
while((line =
in.readLine()) != null) page += line +
"\n";
//endOfFirstPart = page.indexOf("<INSERT FORM STUFF
HERE>");
hiddenStart = page.indexOf("<INSERT
HIDDEN>");
hiddenEnd = hiddenStart + 15;
m_IFErrorP1 =
page.substring(0, hiddenStart);
//m_IFErrorP2 =
page.substring(endOfFirstPart+24, hiddenStart);
m_IFErrorP2 =
page.substring(hiddenEnd, page.length());
in.close();
in = new
BufferedReader(new FileReader("/html/cra/myff/myConf.dat"));
page =
"";
line="";
while((line =
in.readLine()) != null) page +=
line + "\n";
strConfPage =
page;
in.close();
in = new
BufferedReader(new FileReader("/html/cra/myff/myConfcm.dat"));
page =
"";
line="";
while((line =
in.readLine()) != null) page +=
line + "\n";
strConfcmPage =
page;
in.close();
in = new
BufferedReader(new FileReader("/html/cra/myff/myEmail.dat"));
page =
"";
line="";
while((line =
in.readLine()) != null) page += line + "\n";
m_EmailBody = page;
in.close();
} catch
(Exception e) {errStr="Error in reading files. Message: "+e.getMessage().toString();
}
} // end of init.
public void
doPost(HttpServletRequest req, HttpServletResponse res)
throws
ServletException, IOException {
res.setContentType("text/html");
PrintWriter out =
res.getWriter();
if(errStr !=
""){
out.println("<html>" + errStr +
"</html>");
return;
}
/*
FileWriter outtie
= new FileWriter(new File("/tmp/yahooPOST" + timeString() +
".dat"));
outtie.write("____________\n");
outtie.write("|NAME|VALUE|\n");
Enumeration enum
= req.getParameterNames();
while
(enum.hasMoreElements()) {
String name =
(String) enum.nextElement();
String values[]
= req.getParameterValues(name);
if (values !=
null) {
for (int i = 0; i
< values.length; i++) {
outtie.write("|" + name +
"|" + values[i] + "|\n");
}
}
}
outtie.write("------------\n");
outtie.close();
*/
String action =
req.getParameter("action");
if
(action.equals("extract-info")) {
out.println(extractInfo(req));
} else if
(action.equals("validate-user-and-amount")) {
out.println(validateUserAndAmount(req));
} else if
(action.equals("finalize-order")) {
out.println(finalizeOrder(req));
} else if
(action.equals("confirmation")) {
out.println(confirmPro(req));
} else out.println("<html>Error
#1001</html>");
} // end doPost
public void
doGet(HttpServletRequest req, HttpServletResponse res)
throws
ServletException, IOException {
doPost(req,res);
} // end doGet
private String
toEncodedString(Properties args) {
StringBuffer buf
= new StringBuffer();
Enumeration names
= args.propertyNames();
while
(names.hasMoreElements()) {
String name =
(String) names.nextElement();
String value =
args.getProperty(name);
buf.append(URLEncoder.encode(name + "=" + value));
if
(names.hasMoreElements()) buf.append("&");
}
return
buf.toString();
}// end of
toEncodedString
… …
… …
… …
… …
… …
… …
//---NEW LOGIN PAGE---
private String
newlogin(String hidden) {
return
m_UnPErrorP1 + m_UnPErrorP2 + hidden + m_UnPErrorP3;
}
//----VALID
LOGIN----
private String
validlogin(CMAddress address, StringBuffer buf) {
String strConf =
replace(strConfPage, "<CMFIRSTNAME>",address.getFirstName());
strConf =
replace(strConf, "<CMLASTNAME>", address.getLastName() );
//strConf =
replace(strConf, "<CMEMAILADD>", address.getEmail() );
strConf =
replace(strConf, "<CMPHONE>",address.getPhone());
strConf =
replace(strConf, "<CMADDRESS>",address.getAddress());
strConf =
replace(strConf, "<CMCITY>",address.getCity());
strConf =
replace(strConf, "<CMSTATE>",address.getState());
strConf =
replace(strConf, "<CMZIP>",address.getZip());
strConf =
replace(strConf, "<INSERT HIDDEN>",buf.toString());
return strConf;
}
private String
confirmlogin(String address, String city, String state, String zip, String buf,
String totalAmount) {
String strConf =
replace(strConfcmPage, "<TOTAL AMOUNT>", totalAmount);
strConf =
replace(strConf, "<ADDRESS>",address);
strConf =
replace(strConf, "<CITY>",city);
strConf =
replace(strConf, "<STATE>",state);
strConf =
replace(strConf, "<ZIP>",zip);
strConf =
replace(strConf, "<INSERT HIDDEN>",buf);
return strConf;
}
// private static String timeString() {
//return
String.valueOf(System.currentTimeMillis());
//}
} // end yahoo