www.gusucode.com > CC校友录贴吧 CCBar源码程序asp编程 > admin/admin_register.asp

    <%
'===================================================================
'= ASP FILENAME	: /admin/admin_register.asp
'= CREATED TIME : 2006-7-1
'= LAST MODIFIED: 2006-7-1
'= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com
'= DESCRIPTION  : 用户注册设置
'= Change Log:
'===================================================================
%>

<!-- #include file = "../inc/admin/include_admin_action_execute.asp" -->
<!-- #include file = "./admin_inc.asp" -->
<!-- #include file = "../forum/class_html_form.asp" -->
<!-- #include file = "../inc/logic/logic_config.asp" -->

<%
'========================================================
'==   Action参数设置
'========================================================
'== 页面名
Const CONST_PAGE_FILE	= "admin/admin_register.asp"

'== 页面标题/功能
Const CONST_PAGE_TITLE	= "用户注册设置"

'== 功能函数名字空间
Const CONST_ACTION_FUNC	= "FormRegCtl"

'== 相对根目录路径 
GBL_strHomeURL			= "../"

'== 页面构造
Call ActionBuild()

'== 在模板中引用的标签变量
Dim TAG_strVerifyCode
Dim TAG_objDicUnit

'== 请求校验与过滤
Call ActionViewFilterAdmin(CONST_PAGE_FILE,CONST_ACTION_FUNC)


'== 页面析构
Call ActionOver()
%>


<%
'===================================================================
'= Function    : LoadPageTpl()
'= Time		   : Created At 2006-5-4
'= Description : 加载页面模块
'===================================================================
Function LoadPageTpl()
%>
	<!-- #include file = "../template_a/page_admin_register_form.html.asp" -->
<%
End Function
'===================================================================
'= Sub		    : FormRegCtl()
'= Time		    : Created At 2006-7-1
'= Input        : None
'= Output       : None
'= Table        : Query CLASS_REG
'= Description  : 用户注册设置
'===================================================================
Sub FormRegCtl()

	Dim clsForm
	Dim strTmp
	Dim strHtmlCode
	Dim strQuestion(4),strAnswer(4)
	Dim i

	If Request("action") = "FormSaveRegAdmin" Then
		Call FormSaveRegAdmin()
		Exit Sub
	End If

	strHtmlCode = ""

	'== Get now question and answer content
	GBL_objPubDB.Clear()
	GBL_objPubDB.TableName = "CLASS_REG"
	GBL_objPubDB.SQLType = "SELECT"
	GBL_objPubDB.AddField "TOP 5 REG_QUESTION,REG_ANSWER",""
	GBL_objPubDB.Order = "REG_NO ASC"
	GBL_objPubDB.SQLRSExecute()
	Call ResultExecute(GBL_objPubDB.intErrNum,"get now question","ES_ERR")
	If GBL_objPubDB.intRSNum <> 0 Then

		For i = 1 To GBL_objPubDB.intRSNum
			strQuestion(i - 1) = GBL_objPubDB.objPubRS("REG_QUESTION")
			strAnswer(i - 1) = GBL_objPubDB.objPubRS("REG_ANSWER")
			GBL_objPubDB.objPubRS.MoveNext
		Next

	End If

	Set clsForm = New classFormOld
	'== Set form parameters
	clsForm.Action = GBL_strHomeURL & "admin/admin_register.asp?action=FormSaveRegAdmin"
	clsForm.Id = "frmRegAdmin"
	clsForm.Name = "frmRegAdmin"
	clsForm.OnSubmit = "return verify(this)"
	clsForm.ColumnScale = "30%"

	clsForm.MakeForm()
	clsForm.MakeTable "0","0","4","center","80%",""

	'== Get now user set in db
	Dim strTmp1
	strTmp = ""
	strTmp1 = ""
	GBL_objPubDB.Clear()
	GBL_objPubDB.TableName = "CLASS_SETUP"
	GBL_objPubDB.SQLType = "SELECT"
	GBL_objPubDB.AddField "SETUP_USER_REG",""
	GBL_objPubDB.AddField "SETUP_USER_REG_QUES",""
	GBL_objPubDB.SQLRSExecute()
	Call ResultExecute(GBL_objPubDB.intErrNum,"get now user set","ES_ERR")
	If GBL_objPubDB.intRSNum > 0 Then
		strTmp = Cint(GBL_objPubDB.objPubRS("SETUP_USER_REG"))
		strTmp1 =  Cint(GBL_objPubDB.objPubRS("SETUP_USER_REG_QUES"))
	End If
	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*注册方式",GBL_cssFormTdLeft,GBL_cssFormTdRight
	clsForm.AddSelect "selRegMode onChange='SelRegMode()'>",""
	clsForm.AddOption "1","对所有人开放注册",strTmp
	clsForm.AddOption "2","用提问的方式验证注册",strTmp
	clsForm.AddOption "3","注册后由管理员验证",strTmp
	'clsForm.AddOption "4","注册后由校友成员验证",strTmp

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "提 问 项",GBL_cssFormTdLeft,GBL_cssFormTdRight
	clsForm.AddLine "当选择【用提问的方式验证注册】时填写↓"

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*问题数目",GBL_cssFormTdLeft,GBL_cssFormTdRight
	clsForm.AddSelect "selRegQueNum  disabled onChange='SelQues()'",""
	clsForm.AddOption "0","0个问题",strTmp1
	clsForm.AddOption "1","1个问题",strTmp1
	clsForm.AddOption "2","2个问题",strTmp1
	clsForm.AddOption "3","3个问题",strTmp1
	clsForm.AddOption "4","4个问题",strTmp1
	clsForm.AddOption "5","5个问题",strTmp1

	strTmp = ""
	strTmp1 = "<option value='0'>直接回答</option>" & vbCrlf
	strTmp1 = strTmp1 & "<option value='1'>单项选择</option>" & vbCrlf
	strTmp1 = strTmp1 & "<option value='3'>多项选择</option>" & vbCrlf
	strTmp1 = strTmp1 & "</select><br>"
	For i = 1 To 4
		'strTmp = strTmp & "<span style='line-height:15pt;'>回答模式" & i & ":</span><br>"
		strTmp = strTmp & "<span style='line-height:15pt;'>问题内容" & i & ":</span><br>"
		strTmp = strTmp & "<span style='line-height:15pt;'>正确答案" & i & ":</span><br><br>"
		'strHtmlCode = strHtmlCode & "<select name='selFormMode" & i & "'>" & strTmp1
		strHtmlCode = strHtmlCode & "<input type='text' maxlength=100 size=30 name=iptQues" & i & " value='" & strQuestion(i - 1) & "'  disabled   ><br>"
		strHtmlCode = strHtmlCode & "<input type='text' maxlength=100 size=30 name=iptAnsw" & i & " value='" & strAnswer(i - 1) & "'  disabled   ><br><br>"

	Next

	'strTmp = strTmp & "<spanstyle='line-height:16pt;'>回答模式5:</span><br>"
	strTmp = strTmp & "<spanstyle='line-height:16pt;'>问题内容5:</span><br>"
	strTmp = strTmp & "<spanstyle='line-height:16pt;'>正确答案5</span>"
	'strHtmlCode = strHtmlCode & "<select name='selFormMode5'>" & strTmp1
	strHtmlCode = strHtmlCode & "<input type='text' maxlength=100 size=30 name=iptQues5 value='" & strAnswer(4) & "'  disabled   ><br>"
	strHtmlCode = strHtmlCode & "<input type='text' maxlength=100 size=30 name=iptAnsw5 value='" & strAnswer(4) & "'  disabled   >"

	clsForm.AddTr GBL_cssFormTr 
	clsForm.AddTd strTmp,GBL_cssFormTdLeft,GBL_cssFormTdRight
	clsForm.AddLine strHtmlCode

	clsForm.AddTr GBL_cssFormTr & " align=center "
	clsForm.AddSubTd GBL_cssFormTd & " align=center "
	clsForm.AddSub "subFormRegAdmin","提 交","submit"
	clsForm.AddSub "rstFormRegAdmin","重 写","reset"

	clsForm.OutPutForm()
	Set clsForm = Nothing

End Sub
'===================================================================
'= Sub		    : FormSaveRegAdmin()
'= Time		    : Created At DEC,27,2003
'= Input        : None
'= Output       : None
'= Description  : the user register set save
'===================================================================
Sub FormSaveRegAdmin()

	Dim strAddInfo
	Dim intErrId
	Dim intRegQueNum,intRegMode
	Dim arrRegQues,arrRegAnsw

	'== check question numbers
	intErrId = 0
	intRegMode = Trim(Request.Form("selRegMode"))
	strAddInfo = "注册方式"
	intErrId = DataCheck("DT_ENUM",intRegMode,strAddInfo,"1,2,3,4")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")
	intRegMode = Cint(intRegMode)

	intRegQueNum = 0

	'== set register by question
	If intRegMode = 2 Then
		'== check question numbers
		intErrId = 0
		intRegQueNum = Trim(Request.Form("selRegQueNum"))

		strAddInfo = "注册验证问题数目"
		intErrId = DataCheck("DT_ENUM",intRegQueNum,strAddInfo,"0,1,2,3,4,5")
		Call ResultExecute(intErrId,strAddInfo,"ES_ERR")
		If intRegQueNum = "" Then intRegQueNum = 0
		intRegQueNum = Cint(intRegQueNum)

		ReDim arrRegQues(4)
		ReDim arrRegAnsw(4)

		'== get question content and answer content
		arrRegQues(0) = Trim(Request.Form("iptQues1"))
		arrRegAnsw(0) = Trim(Request.Form("iptAnsw1"))
		arrRegQues(1) = Trim(Request.Form("iptQues2"))
		arrRegAnsw(1) = Trim(Request.Form("iptAnsw2"))
		arrRegQues(2) = Trim(Request.Form("iptQues3"))
		arrRegAnsw(2) = Trim(Request.Form("iptAnsw3"))
		arrRegQues(3) = Trim(Request.Form("iptQues4"))
		arrRegAnsw(3) = Trim(Request.Form("iptAnsw4"))
		arrRegQues(4) = Trim(Request.Form("iptQues5"))
		arrRegAnsw(4) = Trim(Request.Form("iptAnsw5"))

		'== check question and answer content
		Dim i
		For i = 0 To intRegQueNum - 1

			strAddInfo = "注册验证问题" & i + 1
			intErrId = DataCheck("DT_FIX_LENGTH",arrRegQues(i),strAddInfo,"1|DTC_LESS_MORE_LEN|100|")
			Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

			strAddInfo = "注册验证问题" & i + 1 & "的答案"
			intErrId = DataCheck("DT_FIX_LENGTH",arrRegAnsw(i),strAddInfo,"1|DTC_LESS_MORE_LEN|100|")
			Call ResultExecute(intErrId,strAddInfo,"ES_ERR")
			
		Next

		'== del old class_reg data
		GBL_objPubDB.Clear()
		GBL_objPubDB.TableName = "CLASS_REG"
		GBL_objPubDB.SQLType = "DELETE"
		GBL_objPubDB.SQLExecute()
		Call ResultExecute(GBL_objPubDB.intErrNum,"del old data before insert reg questions","ES_ERR")

		'== insert into table class_reg
		For i = 1 To intRegQueNum 

			GBL_objPubDB.Clear()
			GBL_objPubDB.TableName = "CLASS_REG"
			GBL_objPubDB.SQLType = "INSERT"
			GBL_objPubDB.AddField "REG_NO", i
			GBL_objPubDB.AddField "REG_QUESTION",arrRegQues(i - 1)
			GBL_objPubDB.AddField "REG_ANSWER",arrRegAnsw(i - 1)
			GBL_objPubDB.AddField "REG_STATUS",0
			GBL_objPubDB.AddField "REG_FORM_MODE",0
			GBL_objPubDB.SQLExecute()
			Call ResultExecute(GBL_objPubDB.intErrNum,"insert reg questions","ES_ERR")
			
		Next

	End If

	'== update config table of user set
	GBL_objPubDB.Clear()
	GBL_objPubDB.TableName = "CLASS_SETUP"
	GBL_objPubDB.SQLType = "UPDATE"
	GBL_objPubDB.AddField "SETUP_USER_REG", intRegMode
	GBL_objPubDB.AddField "SETUP_USER_REG_QUES", intRegQueNum
	GBL_objPubDB.SQLExecute()
	Call ResultExecute(GBL_objPubDB.intErrNum,"update user set ","ES_ERR")

	If Not LoadParaLogic() Then Exit Sub

	'== 成功处理
	Dim strHtmlCode,strSuccUrl
	strHtmlCode = "用户注册设置成功"
	strSuccUrl = "admin_register.asp"
	'Call SuccExecute(strHtmlCode,strSuccUrl)
	Response.Redirect strSuccUrl

End Sub
%>