<%
'****************************************************
'函数名：Checktgzcm
'作  用：检查管理员是否登录
'参  数：True/False
'****************************************************
Function Checktgzcm()
	SiteManageCode=tgzcm(3)
	'检查管理员是否登录
	Site_Sn=Replace(Replace(LCase(Request.ServerVariables("SERVER_NAME") & GetScriptPath(Trim(Request.ServerVariables("SCRIPT_NAME")), 1)), "/", ""), ".", "")
	AdminName = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("AdminName")))
	AdminPassword = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("AdminPassword")))
	RndPassword = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("RndPassword")))
	AdminLoginCode = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("AdminLoginCode")))
	If AdminName = "" Or AdminPassword = "" Or RndPassword = ""  Or AdminLoginCode <> SiteManageCode Then
		Checktgzcm=False
	Else
	    Checktgzcm=True
	End If
End Function

'**************************************************
'函数名：GetRndPassword
'作  用：生成随机
'**************************************************
Function GetRndPassword(PasswordLen)
    Dim Ran, i, strPassword
    strPassword = ""
    For i = 1 To PasswordLen
        Randomize
        Ran = CInt(Rnd * 2)
        Randomize
        If Ran = 0 Then
            Ran = CInt(Rnd * 25) + 97
            strPassword = strPassword & UCase(Chr(Ran))
        ElseIf Ran = 1 Then
            Ran = CInt(Rnd * 9)
            strPassword = strPassword & Ran
        ElseIf Ran = 2 Then
            Ran = CInt(Rnd * 25) + 97
            strPassword = strPassword & Chr(Ran)
        End If
    Next
    GetRndPassword = strPassword
End Function

Function GetScriptPath(ByVal ScriptName, ParentLevel)
    Dim i
    GetScriptPath = "/"
    If ScriptName = "" Or IsNull(ScriptName) Then Exit Function
    If ParentLevel > 1 Then ParentLevel = 1
    If ParentLevel = 0 Then
        GetScriptPath = Left(ScriptName, InStrRev(ScriptName, "/"))
    ElseIf ParentLevel = 1 Then
        i = InStrRev(ScriptName, "/") - 1
        If i < 1 Then i = 1
        GetScriptPath = Left(ScriptName, InStrRev(ScriptName, "/", i))
    End If
    If Right(GetScriptPath, 1) <> "/" Then GetScriptPath = GetScriptPath & "/"
End Function
%>