%--/* Programmer: Rick Reuvekamp Verion: 2.00 File: index.jsp Requires: * directories: *: ./includes/ *: ./news/ *: ./menu/ * files: *: ./notfound.html *: ./emptyparameter.html *: ./default.html *: ./default.jsp *: ./menu/default.html */--%><%@ page import="java.net.*, java.io.*, java.util.*, javax.mail.*, javax.mail.internet.*, javax.servlet.http.Cookie, javax.servlet.http.HttpSession" %><%! void Mail (String args[]) { /*String host = args[0]; String from = args[1]; String to = args[2]; String cc = args[3]; String s_subject = args[4]; String s_message = args[5]; // Get system properties Properties props = System.getProperties(); // Setup mail server props.put("mail.smtp.host", host); // Get session Session session = Session.getDefaultInstance(props, null); // Define message MimeMessage message = new MimeMessage(session); // Set the from address message.setFrom(new InternetAddress(from)); // Set the to address message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); // Set the subject message.setSubject("Hello JavaMail"); // Set the content message.setText("Welcome to JavaMail"); // Send message Transport.send(message);*/ } String replace(String s, String one, String another) { if (s.equals("")) return ""; String res = ""; int i = s.indexOf(one,0); int lastpos = 0; while (i != -1) { res += s.substring(lastpos,i) + another; lastpos = i + one.length(); i = s.indexOf(one,lastpos); } res += s.substring(lastpos); return res; } void copyhtmlxmllocal(String urlpath, File xmlfile) { try { if (xmlfile.exists()) { Date curDate = new java.util.Date(); Date xmlfileDate = new Date(xmlfile.lastModified()); Calendar xmlfileGC = new GregorianCalendar(xmlfileDate.getYear(), xmlfileDate.getMonth(), xmlfileDate.getDate(), xmlfileDate.getHours(), xmlfileDate.getMinutes(), 0); Calendar curGC = new GregorianCalendar(curDate.getYear(), curDate.getMonth(), curDate.getDate(), curDate.getHours(), curDate.getMinutes(), 0); long diff = curGC.getTimeInMillis() - xmlfileGC.getTimeInMillis(); if (3600000 <= diff) { URL url = new URL(urlpath); URLConnection connection = url.openConnection(); InputStream stream = connection.getInputStream(); BufferedInputStream in = new BufferedInputStream(stream); FileOutputStream xmlfiledata = new FileOutputStream(xmlfile); BufferedOutputStream outputdata = new BufferedOutputStream(xmlfiledata); int i; while ((i = in.read()) != -1) { outputdata.write(i); } outputdata.flush(); } } } catch (IOException ioe) { ioe.printStackTrace(); } } %><% // Initizalizing String subdirectory = "/"; // needed when you are using a sub directory from the website path. // Declaration of variables: String root = application.getRealPath(subdirectory); String menupath = "menu/default.jsp"; String filepath = "default.html"; String filteredparameter = "default"; String item = request.getParameter("item"); String parameter = request.getParameter("page"); String actionstr = request.getParameter("action"); String Message = ""; boolean loggedin = false; session = request.getSession(false); //session.setMaxInActiveInterval(); // mail String SMTP_HOST_NAME = "smtp.tradpaq.com"; String SMTP_AUTH_USER = "rreuveka"; String SMTP_AUTH_PWD = "akevuerr600"; String[] emailList = {"rreuvekamp@tradepaq.com", "rick.reuvekamp@planet.nl"}; String emailMsgTxt = "Generated mail from on-line forum:"; String emailSender = "failed@tradepaq.com"; boolean go = true; // Anti-directory up/down filter if (parameter != null) { parameter = replace(parameter,"'","\\\'"); parameter = replace(parameter,"\"","\\\""); parameter = replace(parameter,"\\","\\\\"); if (parameter.indexOf("..") != -1) parameter = null; } if (actionstr != null) { actionstr = replace(actionstr,"'","\\\'"); actionstr = replace(actionstr,"\"","\\\""); actionstr = replace(actionstr,"\\","\\\\"); if (actionstr.indexOf("..") != -1) actionstr = null; } // Check for xml (rss feeds) updates //copyhtmlxmllocal("http://finance.yahoo.com/rss/SteelIron",new File(root + "/steeliron.xml")); //copyhtmlxmllocal("http://finance.yahoo.com/rss/Aluminum",new File(root + "/aluminium.xml")); //copyhtmlxmllocal("http://finance.yahoo.com/rss/Copper",new File(root + "/copper.xml")); //copyhtmlxmllocal("http://tweakers.net/feeds/mixed.xml",new File(root + "/tweakers.xml")); //copyhtmlxmllocal("http://finance.yahoo.com/rss/PersonalComputers",new File(root + "/pc.xml")); //copyhtmlxmllocal("http://finance.yahoo.com/rss/AgriculturalChemicals",new File(root + "/agricultural.xml")); // Check login if (request.getParameter("action") != null && request.getParameter("action").equals("security")) { Message = "