home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Sample.bin
/
PHOwner.java
< prev
next >
Wrap
Text File
|
1998-10-17
|
3KB
|
112 lines
package symantec.sourcebook.servlet;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class PHOwner extends PageHandler
{
int pagenumber = ESDServlet.DOWNLOAD_PAGE_NUM;
private final static String PAGENAME = PAGEBASE + "owner.html";
public PHOwner()
{
}
public String pageName()
{
return PAGENAME;
}
public int nextPage()
{
return pagenumber;
}
protected void customize(Object pageDataObject) throws IOException
{
PageData ownerData = (PageData) pageDataObject;
String fieldText = "<input type=\"hidden\" name=\"orderID\" value=\""+ ownerData.transaction.orderID +"\"> ";
fieldText += ownerData.transaction.name + "<br>" +
ownerData.transaction.company + "<br>" +
ownerData.transaction.email + "<br>" +
ownerData.transaction.address + "<br>" +
ownerData.transaction.city + " " + ownerData.transaction.state + " " + ownerData.transaction.zip + "<br>" +
ownerData.transaction.country + " " + ownerData.transaction.phone +"<br>" ;
insert("fieldPosition",fieldText);
insert("ownerIDPosition",ownerData.transaction.orderID);
}
public Object validate(ServletConfig config,HttpServletRequest request,HttpServletResponse response) throws IOException
{
Transaction t;
String name;
String orderId;
String total;
PageData pageData = new PageData(config,request,response);
orderId = getParameter(request,"orderID","");
if(orderId.length() ==0)
{
pagenumber = ESDServlet.ERROR_PAGE_NUM;
pageData.messageText = "Invalid order processing identification (1)";
return pageData;
}
t = Transaction.findTransaction(orderId);
if(t==null)
{
pagenumber = ESDServlet.ERROR_PAGE_NUM;
pageData.messageText = "Invalid order processing identification (2)";
return pageData;
}
// check status of this transaction
if( (t.verified && !t.accepted) || // credit was already declined on this order ID
(t.downloadCount > 12)) // excessive downloads... suspend
{
pagenumber = ESDServlet.ERROR_PAGE_NUM;
pageData.messageText = "This order has been suspended. Please contact the company.";
return pageData;
}
// if record has not yet been validated with web order, contact host
if(!t.verified)
{
// NOTE: In a live system you should
// contact host and verify order here!
// (to prevent hackers from bypassing the credit card screen)
// Dummy verification
t.verified = true;
t.accepted = true;
}
t.record();
pageData.transaction = t;
return pageData;
}
}