The source code is as follows:
<% ' ==========================================================================
'
' User Login Authentication class
'
' Name:checklogin
'
' Author:infozero
' Date:2006-5-28
'
' COMMENT: User Login Authentication Class
'
'==========================================================================
Class Checklogin
'==========================================================================
' Function: Sensitive character filtering
' Str---> characters to filter
' ReturnCode---> return type, 0-digit; 1-character. Returns a null value if the number contains sensitive characters, and the default return string
'==========================================================================
Private Sub Class_Initialize ()
Dim Loginflag:loginflag = 0
End Sub
' Private Function getsafestr (Str,returncode)
' Dim Temp
' Select case ReturnCode
' Case 0
' If isnumeric (Str) = False Then
' Temp = '
' Else
' Temp = Str
' End If
' Case 1
' Temp = Replace (str, ' ' ', ' ' ')
' Temp = Replace (str, <, "")
' Temp = Replace (str, >, "")
' Case Else
' Temp = Replace (str, ' ' ', ' ' ')
' End Select
' Getsafestr = Temp
' End Function
'==========================================================================
' Verify user Login
' Frmname user-entered user name
' Frmpassword user-entered password
' User name in Tagetname datasheet
' Targetpassword the code in the data table
'==========================================================================
Public Sub Checklogininfo (Frmname,frmpassword,tagetname,targetpassword)
If frmname = tagetname and Frmpassword = Targetpassword Then
Loginflag = 1
Session ("LoginName") = Frmname
End If
End Sub
'==========================================================================
' Access to the user's login information can be based on this to determine whether the user has landed
'==========================================================================
Public Function Loginnameinfo ()
Loginnameinfo = Session ("LoginName")
End Function
'==========================================================================
' Determine if the user is logged in as an administrator, and the default is no
' If you want to confirm that you are logged in as an administrator, the value of Yesorno is 1.
'==========================================================================
Public Function ISAdmin (Yesorno)
If Trim (Loginnameinfo ()) <> "" and Yesorno = "Yes" Then
ISAdmin = True
Else
ISAdmin = False
End If
End Function
'==========================================================================
' Implement directory-level access restrictions on Web site resources
' Denydir-restricted folders such as/cls/test/
' Errpage-no landing on the prompt page when accessing restricted folders
' Adminpermission-allow admin to access 0-no, 1-yes
'==========================================================================
Public Function dirpermission (ByVal denydir,byval errpage,adminpermission)
Dim Target
Target = Trim (Request.ServerVariables ("Script_name"))
If InStr (Target,denydir) <> 0 and adminpermission = 0 and ISAdmin ("yes") = False Then
Response.Redirect (Errpage)
End If
End Function
Private Sub Class_Terminate ()
Loginflag = 0
End Sub
End Class
%>