<%@ page language="java" import="java.util.*,java.net.URLDecoder,java.net.URLEncoder,com.letousky.lottery.delegate.WinsFlat,com.letousky.exception.LotteryException" pageEncoding="UTF-8"%>
<%@page import="com.fivestars.interfaces.bbs.util.XMLHelper"%>
<%@page import="com.fivestars.interfaces.bbs.client.Client"%>
<%@page import="com.letousky.lottery.util.HttpClientUtil"%>
<%
	String[] params=new String[4];
	params[0] = request.getParameter("username");
	params[0]=java.net.URLDecoder.decode(params[0],"utf-8");
	params[1] = request.getParameter("password");
	params[2] = request.getParameter("code");
	params[3] = request.getParameter("validateCode");
	String pages = request.getParameter("pages");

	String result=null;
	try{
	
		result = new WinsFlat().newLogin(request,response,params);
		if("ucSuccess".equals(result)){
			HttpClientUtil http = new HttpClientUtil();
			Map map = new HashMap();
			map.put("mod", "logging");
			map.put("action", "login");
			map.put("loginsubmit", "yes");
			map.put("infloat", "yes");
			map.put("lssubmit", "yes");
			map.put("username",java.net.URLDecoder.decode(params[0]));
			map.put("password",params[1]);
			map.put("cookietime", "2592000");
			String sendValue = http.execute("http://www.jingcaile.com/bbs/upload/member.php",map);
			session.setAttribute("sendValue",sendValue);
		}
		if(pages!=null && !"".equals(pages)){
			if(params[0]!=null && params[1]!=null){
					String p = "";
					if("index".equals(pages))
					  { 
					  	p = "bbs/upload";
					  }
				    else if("union".equals(pages))
				      {
				      	p = "union";
				      }else{
				      	p = pages;
				      }
					response.sendRedirect("http://www.jingcaile.com/letoula/userOut_return.jsp?pages="+p);
			}
		}else{
			out.print(result);
		}
	}catch(LotteryException e){
		out.print("系统异常");
	}
%>


