<% /* History: 1/15/04 dvk - Removed '3 download' limit We get here from password.jsp if user just purchased with parameters password1 and password2 set and session errFlag = "ok". Updates Password in MemberProfile table and sends second confirmation email (with password and link to download.jsp). We also get here, from Download button, but redirect to login.jsp if user is not logged in, and then redirects here. We also get here directly from addPurchase.jsp if user is an existing member (did not need to get password. In which case, errFlag = "sendEmail" and session pw has password to send in confirmation email. If a user has downloaded a purchased component set three times it does not show in the list. */ %> <%@ page import="java.io.*" %> <%@ page import="java.sql.*" %> <%@ page import="java.util.*" %> <%@ page import="java.text.*" %> <%@ page import="javax.servlet.*" %> <%@ page import="javax.servlet.http.*" %> <%@ page import="java.net.*" %> <%@ page import="mySqlPool.*" %> <%@ page import="javax.mail.*" %> <%@ page import="javax.mail.internet.*" %> <%@ page import="getDownloadDir.*" %> <%! mySqlPool poolConn = mySqlPool.getInstance(); // All db connections from common pool getDownloadDir getDir = getDownloadDir.getInstance(); // All db connections from common pool %> <% String errFlag = (String)session.getAttribute("errFlag"); // Should be "ok", but could // be error message or "sendEmail" if coming here directly from addPurchaseCS.jsp. if (errFlag == null) // May be coming from addPurchaseCS.jsp from plugnpay errFlag = request.getParameter("errFlag"); if (errFlag == null) errFlag = "ok"; String email = (String)session.getAttribute("email"); if (email == null) // May be coming from addPurchaseCS.jsp from plugnpay email = request.getParameter("email"); String orderID = request.getParameter("orderID"); // set in addPurchaseCS.jsp String dlDir = getDir.getDirName(); // Download directory changes daily String pw = request.getParameter("password1"); // If here from password.jsp Connection conn = null; String dwnldList = null; if (email == null) { // Need to have user login session.setAttribute("ref", "download.jsp"); // wants download.jsp but has to log in first response.sendRedirect("login.jsp"); } if (pw != null && errFlag.equals("ok") && email != null && orderID != null) { // Here from addPurchaseCS.jsp after purchase. Update MemberProfile with password try { conn = poolConn.openConnection(); StringBuffer sb = new StringBuffer(); sb.append("UPDATE MemberProfile SET Password = ? WHERE EmailAddress = ?"); PreparedStatement ps = conn.prepareStatement(sb.toString()); ps.clearParameters(); ps.setString(1, pw); ps.setString(2, email); int success = ps.executeUpdate(); conn = poolConn.close(conn); } catch(SQLException sqle) { errFlag = "Error:" + sqle.getMessage(); } session.setAttribute("errFlag", "done"); // don't want to do this again // Also need to send confirmation email with link to download.jsp errFlag = mailMsgCS(pw, email); } else if (orderID != null) { // here from addPurchaseCS.jsp but already have password pw = request.getParameter("pw"); // still need to send email confirmation if (pw != null) errFlag = mailMsgCS(pw, email); } // Need to get list (user logged in but not here yet) int nn = 0; try { conn = poolConn.openConnection(); StringBuffer sb = new StringBuffer(); sb.append("select itemID from Purchase where EmailAddress = ?"); PreparedStatement ps = conn.prepareStatement(sb.toString()); ps.clearParameters(); ps.setString(1, email); ResultSet rs = ps.executeQuery(); conn = poolConn.close(conn); sb.setLength(0); while (rs.next()) { sb.append(rs.getString(1) + "~"); nn++; } dwnldList = sb.toString(); session.setAttribute("dwnldList", dwnldList); } catch(SQLException sqle) { errFlag = "Error:" + sqle.getMessage(); } %> VisionBlazer Flash Components Text Effects <% // %>
Text Effects
Clip Art
Interface Elements
VisionBlazer Flash Components Download
 
  <% if (errFlag != null && errFlag.indexOf("Error") > -1) { %>
 
     
<%=errFlag%>. Please contact Customer Support
<% } else { if (dwnldList.indexOf("textEffects") > -1) { %>
Text Effects
 
Fat Download, many fonts, 10 MB Thin Download, few fonts, 1 MB
<% } %> <% if (dwnldList.indexOf("interfaceElements") > -1) { %>
Interface Elements Download Interface Elements
<% } %> <% if (dwnldList.indexOf("clipArt") > -1) { %>
Clip Art Download Clip Art
I
<% } } %>
If you have downloaded an item 3 times it may no longer show in the download list.
 
 
<%! // Functions public String mailMsgCS (String pw, String To) throws IOException { String mailhost = null; String OS = System.getProperty("os.name"); if(OS.equals("Linux")) { mailhost = "sendMailServer"; // User database.web-animator.com server } else { mailhost = "smtp.eapps.com"; } String senderAddress = "CustomerSupport@animation-online.com"; StringBuffer sb = new StringBuffer(); // JavaMail here. Properties props = System.getProperties(); props.put("mail.smtp.host", mailhost); Session emailsession = Session.getDefaultInstance(props, null); try { Message email = new MimeMessage(emailsession); email.setFrom(new InternetAddress(senderAddress)); InternetAddress[] address = {new InternetAddress(To) }; InternetAddress bccAddress = new InternetAddress("support@visionblazer.com"); email.setRecipients(Message.RecipientType.TO,address); email.setSubject("Purchase: VisionBlazer Components from Animation-Online"); email.setSentDate(new java.util.Date()); email.setHeader("X-Mailer","MailFormJava"); sb.append("Thank you for your purchase of VisionBlazer Components.\n"); sb.append("If you have not already downloaded the Component Sets you purchased, click the link below:\n\n"); sb.append("http://www.animation-online.com/site/download.jsp \n\n"); sb.append("Your login ID is your email address.\n"); sb.append("Your password is: " + pw); email.setText(sb.toString()); Transport.send(email); } catch (MessagingException e) { return ("Error:" + e.getMessage()); } return("ok"); } %>