<%@ page contentType="text/html;charset=utf-8"
import = "java.io.File"
import = "cn.js.fan.util.*"
%>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="cn.js.fan.web.Global"%>
<%@ page import="com.redmoon.forum.person.UserSet"%>
<%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
<%
String skincode = UserSet.getSkin(request);
if (skincode.equals(""))
	skincode = UserSet.defaultSkin;
SkinMgr skm = new SkinMgr();
Skin skin = skm.getSkin(skincode);
if (skin==null)
	skin = skm.getSkin(UserSet.defaultSkin);
String skinPath = skin.getPath();
%>
<html>
<head>
<title><%=Global.AppName%> - <lt:Label res="res.label.regist" key="regist"/></title>
<%@ include file="inc/nocache.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="forum/<%=skinPath%>/skin.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%@ include file="forum/inc/header.jsp"%>
<br>
<br>
<jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil" />
<jsp:useBean id="userservice" scope="page" class="com.redmoon.forum.person.userservice" />
<jsp:useBean id="form" scope="page" class="cn.js.fan.security.Form" />
<%
com.redmoon.forum.Config cfg = new com.redmoon.forum.Config();
boolean usevcode = cfg.getBooleanProperty("forum.registUseValidateCode");
if (usevcode) {
	String sessionCode = StrUtil.getNullStr((String) session.getAttribute("validateCode"));
	String validateCode = ParamUtil.get(request, "validateCode");
	if (!validateCode.equals(sessionCode)) {
		out.print(StrUtil.Alert_Back(SkinUtil.LoadString(request, "res.label.regist", "err_validate_code")));
		return;
	}
}

boolean cansubmit = false;
int interval = cfg.getIntProperty("forum.registInterval");
int maxtimespan = interval;
try {
	cansubmit = form.cansubmit(request, "regist", maxtimespan); // 防止重复刷新	
}
catch (ErrMsgException e) {
	out.println(StrUtil.Alert_Back(e.getMessage()));
	return;
}

boolean isSuccess = false;
try {
	isSuccess = userservice.regist(request, response);
}
catch (ErrMsgException e) {
	out.println(StrUtil.Alert_Back(e.getMessage()));
	return;
}
if (isSuccess) {
	out.println(StrUtil.waitJump(SkinUtil.LoadString(request, "res.label.regist", "regist_success"), 3, "forum/index.jsp"));
}
else
	out.println(StrUtil.Alert_Back(SkinUtil.LoadString(request, "res.label.regist", "regist_fail")));
%><br>
<br>
<%@ include file="forum/inc/footer.jsp"%>
</body>
</html>


