<!-- #include file=../inc/BBSsetup.asp -->
<!-- #include file=../inc/Board_Popfun.asp -->
<!-- #include file=../inc/Limit_fun.asp -->
<!-- #include file=inc/UserTopic.asp -->
<!-- #include file=inc/Mail_fun.asp -->
<%
Response.Expires = 0 
Response.ExpiresAbsolute = DEF_Now - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private" 
Response.CacheControl = "no-cache"

DEF_BBS_HomeUrl = "../"
initDatabase

SiteHead(DEF_SiteNameString & " - 社员社员区")
UpdateOnlineUserAtInfo GBL_board_ID,"激活社员"

Dim HomeUrl
HomeUrl = "http://"&Request.ServerVariables("server_name")
If Request.ServerVariables("SERVER_PORT") <> "80" Then HomeUrl = HomeUrl & ":" & Request.ServerVariables("SERVER_PORT")
HomeUrl = Lcase(HomeUrl & Request.Servervariables("SCRIPT_NAME"))
HomeUrl = Replace(HomeUrl,"user/usergetpass.asp","")

Dim AttestNumber
AttestNumber = Left(Request("AttestNumber"),14)
If isNumeric(AttestNumber) = False Then AttestNumber = 0
AttestNumber = Fix(cCur(AttestNumber))

UserTopicTopInfo
DisplayUserNavigate("激活社员")%>
<table width=96%>
<tr>
<td>
<%
If GetBinarybit(GBL_CHK_UserLimit,1) = 0 and GBL_CHK_UserLimit <> "" and GBL_CHK_TempStr = "" and GBL_UserID > 0 Then
	Response.Write "<p><br>此社员已经激活，不必再进行激活操作。<br>" & VbCrLf
Else
	DisplayTurnOnUserForm
End If%>
</td>
</tr>
</table>
<%
UserTopicBottomInfo
closeDataBase
SiteBottom
If GBL_ShowBottomSure = 1 Then Response.Write GBL_SiteBottomString


Function DisplayTurnOnUserForm

	If Request("submitflag") = "yes" and GBL_CHK_TempStr = "" Then
		If GBL_CHK_Flag = 1 and GBL_UserID > 0 Then
			If GetBinarybit(GBL_CHK_UserLimit,1) = 0 and GBL_CHK_UserLimit <> "" Then
				Response.Write "<p><br>此社员已经激活，不必再进行激活操作。<br>" & VbCrLf
			Else
				Dim Rs,SQL
				SQL = "Select BoardID from LeadBBS_SpecialUser where UserID=" & GBL_UserID
				Set Rs = Con.ExeCute(SQL)
				If Rs.Eof Then
					Rs.Close
					Set Rs = Nothing
					Response.Write "<br><br><font color=ff0000 class=RedFont><b>此社员无法由社员进行激活，请联系管理员.</b></font><br>" & VbCrLf
					Exit Function
				End If
				SQL = cCur(Rs(0))
				Rs.Close
				Set Rs = Nothing
				If SQL < 1 Then
					Response.Write "<br><br><font color=ff0000 class=RedFont><b>此社员无法由社员自行激活，请联系管理员.</b></font><br>" & VbCrLf
				Else
					If AttestNumber = SQL Then
						Con.ExeCute("Delete from LeadBBS_SpecialUser where UserID=" & GBL_UserID)
						Con.ExeCute("Update LeadBBS_User Set UserLimit=" & SetBinarybit(GBL_CHK_UserLimit,1,0) & " where ID=" & GBL_UserID)
						UpdateSessionValue 2,SetBinarybit(GBL_CHK_UserLimit,1,0),0
						Response.Write "<br><br><font color=008800 class=GreenFont><b>社员成功激活，<a href=Login.asp?User=" & urlencode(GBL_CHK_User) & "&Relogin=Yes>请重新登录访问社区</a>.</b></font><br>" & VbCrLf
					Else
						Randomize
						Con.ExeCute("Update LeadBBS_User Set Prevtime=" & GetTimeValue(DEF_Now) & ",Login_IP='" & Replace(GBL_IPAddress,"'","''") & "',Login_lastpass='" & Fix(rnd*99999) & "',Login_falsenum=Login_falsenum+1 Where ID=" & GBL_UserID)
						UpdateSessionValue 11,GetTimeValue(DEF_Now),0
						UpdateSessionValue 7,Fix(rnd*99999),0
						UpdateSessionValue 8,1,1
						Response.Write "<br><p><font color=red class=RedFont>验证码错误，注册社员激活失败！</font>"
						DisplayTurnOnForm
					End If
				End If
			End If
		Else
			If GBL_CHK_TempStr = "" Then
				If GBL_CHK_User = "" or GBL_CHK_Pass = "" Then GBL_CHK_TempStr = "请输完整社员名和密码资料."
			End If
			Response.Write "<br><p><font color=red class=RedFont>" & GBL_CHK_TempStr & "</font>"
			DisplayTurnOnForm
		End If
	Else
		DisplayTurnOnForm
	End If

End Function

Function DisplayTurnOnForm%>

	<script language="javascript">
	function submitonce(theform)
	{
		if (document.all||document.getElementById)
		{
			for (i=0;i<theform.length;i++)
			{
				var tempobj=theform.elements[i];
				if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
				tempobj.disabled=true;
			}
		}
	}
	</script>
<p><br>
<font color=Red class=RedFont><b><%=GBL_CHK_TempStr%></b></font>
<br>
请输入您要激活的账号，密码及验证码。
<form action=<%=DEF_BBS_HomeUrl%>User/UserTurnOn.asp method="post" onSubmit="submitonce(this);">
	社员名: <input name=User type=text maxlength=20 size=22 value="<%
	If GBL_CHK_user = "" or isNull(GBL_CHK_user) Then
		Response.Write htmlencode(Request("user"))
	Else
		Response.Write htmlencode(GBL_CHK_user)
	End If%>" class=fminpt><br><input name=submitflag type=hidden value="yes">
	密&nbsp; 码: <input name=pass type=password maxlength=20 size=22 value="<%'=htmlencode(GBL_CHK_Pass)%>" class=fminpt><br>
	验证码: <input name=AttestNumber type=text maxlength=10 size=22 value="<%If AttestNumber > 0 Then Response.Write AttestNumber%>" class=fminpt><br>
	<br><input type=submit value="激活社员" class=fmbtn> <input type=reset value="取消" class=fmbtn>
</form>
说明：如果您的账号需要激活，请填完整上面的三项内容，并点击激活账号按钮。<br>
&nbsp; &nbsp; &nbsp; 认证码在注册时就已经发送到您的邮箱，输入正确的认证码才能激活您的账号。<br>
&nbsp; &nbsp; &nbsp; 某些账号只能由管理员才能激活，利用此功能将仍然无法激活。<br>

<%End Function%>

