SoFunction
Updated on 2025-04-08

Log in asp class


<!-- #include file="" -->
<!-- #include file="cls_main.asp" -->
<!-- #include file="cls_md5.asp" -->
<% dim obj
set obj = New admin_login
    call ()
set obj = nothing

class admin_login
    Private Founderr, errmsg,Mesky
    Private Sub Class_Initialize()
        Founderr = False
        Set Mesky = New Cls_Main
    End Sub
    Private Sub Class_Terminate()
        Set Mesky = Nothing
    End Sub
    Public Sub Main()
         "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"" ""http:///TR/html4/"">" & vbCrLf
         "<html>" & vbCrLf
         "<head>" & vbCrLf
         "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">" & vbCrLf
"<title>Dynamic Download System V3.0—Administrator Login Powered By:</title>" & vbCrLf
         "</head>" & vbCrLf
         "<style type=text/css>" & vbCrLf
         "body {" & vbCrLf
         "    background:#EFEFEF;" & vbCrLf
         "    font-size: 12px;" & vbCrLf
         "    margin-top:0px;" & vbCrLf
         "}" & vbCrLf
         vbCrLf
         "INPUT {" & vbCrLf
         vbCrLf
         "    FONT-SIZE: 12px;" & vbCrLf
" font-family: """Song style";" & vbCrLf
         "}" & vbCrLf
         "SPAN {" & vbCrLf
         "    FONT-SIZE: 12px; POSITION: static" & vbCrLf
         "}" & vbCrLf
         "a:link,a:visited  {" & vbCrLf
         "    color: #0033FF;" & vbCrLf
         "    text-decoration: none;" & vbCrLf
         "}" & vbCrLf
         "</style>" & vbCrLf
         "<p>&nbsp;</p>" & vbCrLf
         "<p>&nbsp;</p>" & vbCrLf
         "<table align=center width=380 style=""border: outset 3px;"" cellpadding=0 cellspacing=0 ID=""Table1"">" & vbCrLf
         "    <tr>" & vbCrLf
         "        <td style=""padding:3px;background-color:blue;color:white;"">Login MeskyDMS V3Powered By:</td>" & vbCrLf
         "    </tr>" & vbCrLf
         "    <tr valign=top>" & vbCrLf
         "        <td><img src=""images/admin_title.gif"" width=""100%""></td>" & vbCrLf
         "    </tr>" & vbCrLf
         "    <tr>" & vbCrLf
         "        <td style=""padding:15px;"">" & vbCrLf
        Dim username
        Dim password
        Dim ip
        Dim BrowserType

        
        Select Case Request("action")
            Case "chklogin"
                Call chklogin
                If Founderr Then
                     (errmsg)
("<br><br><< = <a href=""admin_login.asp"">Return to the administrator login page</a>")
                End If
            Case "logout"
                Call logout
            Case Else
                Call login
        End Select
         "        </td>" & vbCrLf
         "    </tr>" & vbCrLf
         "    <tr><td style=""padding:10px;"">" & vbCrLf
        Set BrowserType = New Cls_Browser
("Client operating system:" & & "<br>Client browser: " & & ) & vbCrLf
        Set BrowserType = Nothing
         "</td></tr>" & vbCrLf
         "</table><br><br>" & vbCrLf
         "</body>" & vbCrLf
         "</html>" & vbCrLf
    End Sub
Sub logout()    'User logout
        Session("adminName") = ""
        Session("adminPass") = ""
        Call login
    End Sub

Sub login()'User login
    On Error Resume Next
    Dim Ados, GetCode
    ' Ados = ("")
    If Err Then
        GetCode = 9999
    End If
         "<script language=""Javascript""><!--" & vbCrLf
         "function VF_loginform(){ //v2.0" & vbCrLf
         "<!--start_of_saved_settings-->" & vbCrLf
"<!--type,text,name,verifycode,required,true,isNum,errMsg, please fill in the confirmation password on the right. -->" & vbCrLf
"<!--type,password,name,password,required,true,errMsg, please fill in your login password!-->" & vbCrLf
"<!--type,text,name,username,required,true,errMsg, please fill in the login username!-->" & vbCrLf
         "<!--end_of_saved_settings-->" & vbCrLf
         "    var theForm = ;" & vbCrLf
         "    var numRE = /^\d+$/;" & vbCrLf
         "    var errMsg = """";" & vbCrLf
         "    var setfocus = """";" & vbCrLf
         vbCrLf
         "    if (!(theForm['verifycode'].value)){" & vbCrLf
"             errMsg = ""Please fill in the confirmation password on the right."";" & vbCrLf
         "        setfocus = ""['verifycode']"";" & vbCrLf
         "    }" & vbCrLf
         "    if (theForm['password'].value == """"){" & vbCrLf
"              errMsg = ""Please fill in your login password!"";" & vbCrLf
         "        setfocus = ""['password']"";" & vbCrLf
         "    }" & vbCrLf
         "    if (theForm['username'].value == """"){" & vbCrLf
"               errMsg = ""Please fill in the login username!"";" & vbCrLf
         "        setfocus = ""['username']"";" & vbCrLf
         "    }" & vbCrLf
         "    if (errMsg != """"){" & vbCrLf
         "        alert(errMsg);" & vbCrLf
         "        eval(""theForm"" + setfocus + "".focus()"");" & vbCrLf
         "    }" & vbCrLf
         "    else ();" & vbCrLf
         "}//-->" & vbCrLf
         "</script>" & vbCrLf
         "        <table  border=""0"">" & vbCrLf
         "        <form action=""?action=chklogin"" method=""post"" name=""loginform"" onsubmit=""VF_loginform();return false;""> " & vbCrLf
         "          <tr>" & vbCrLf
"                       <td><span style=""width:80px;"">Username:</span></td>" & vbCrLf
         "            <td><input maxlength=20 type=""text"" name=""username"" style=""width:200px;"" tabindex=""1""></td>" & vbCrLf
         "          </tr>" & vbCrLf
         "          <tr>" & vbCrLf
"                    <td><span style=""width:80px;"">Password: </span></td>" & vbCrLf
         "            <td><input maxlength=20 type=""password"" name=""password"" style=""width:200px;""></td>" & vbCrLf
         "          </tr>" & vbCrLf
         "          <tr>" & vbCrLf
"                    <td><span style=""width:80px;"">Verification code: </span></td>" & vbCrLf
         "            <td><input name=""verifycode"" type=""text"" style=""width:60px;"" value="""
        If GetCode = 9999 Then  "9999"
         """  maxlength=4> " & vbCrLf
"Please enter in the verification code box: <img src=""""></td>" & vbCrLf
         "          </tr>" & vbCrLf
         "          <tr>" & vbCrLf
         "            <td>&nbsp;</td>" & vbCrLf
         "            <td align=""right"">&nbsp;</td>" & vbCrLf
         "          </tr>" & vbCrLf
         "          <tr>" & vbCrLf
         "            <td>&nbsp;</td>" & vbCrLf
""                         <td align=""right""><input type=""submit"" value=""Login..."" name=""btnSubmit"" style=""width:80px;font:menu;"" ID=""Submit1""></td>" & vbCrLf
         "          </tr>" & vbCrLf
         "          </form>  " & vbCrLf
         "        </table>" & vbCrLf

    End Sub
'Check user login
    Sub chklogin()
        Dim UserName,Password,IP
        username = Trim(Replace(Request("username"), "'", ""))
        password = MD5(Trim(Replace(Request("password"), "'", "")), 16)
        If Request("verifycode") = "" Then
errmsg = errmsg + "<br>" + "<li>Please return to enter the confirmation code."
            Founderr = True
        ElseIf Session("getcode") = "9999" Then
            Session("getcode") = ""
        ElseIf Session("getcode") = "" Then
errmsg = errmsg + "<br>" + "<li>Please do not submit repeatedly. If you need to log in again, please return to the login page."
            Founderr = True
        ElseIf CStr(Session("getcode")) <> CStr(Trim(Request("verifycode"))) Then
errmsg = errmsg + "<br>" + "<li>The confirmation code you entered is inconsistent with the system, please re-enter."
            Founderr = True
        End If
        Session("getcode") = ""
        If username = "" Or password = "" Then
            Founderr = True
errmsg = errmsg + "<br>" + "<li>Please enter your username or password.<li>"
        End If
        If Founderr Then Exit Sub
        ip = Replace(("REMOTE_ADDR"), "'", "")
        Dim Rs

        Set Rs = ("select * from Mesky_SiteManager where username='" & username & "'")
        If  And  Then
            Set Rs = Nothing
            Founderr = True
errmsg = errmsg + "<br>" + "<li>The username and password you entered are incorrect or you are not a system administrator.<br><li>Please <a href=admin_login.asp>Re-enter</a> your password."
            Exit Sub
        Else
            If Trim(Rs("password")) <> password Then
                Founderr = True
errmsg = errmsg + "<br>" + "<li>The username and password you entered are incorrect or you are not a system administrator.<br><li>Please <a href=admin_login.asp>Re-enter</a> your password."
                Set Rs = Nothing
                Exit Sub
            Else
            Session("adminName") = Rs("UserName")
            Session("adminPass") = Rs("Password")
             = 45
             ("update Mesky_SiteManager set LastLogin= " & SqlNowString & ",LastLoginIP='" & ip & "',LastActive=" & SqlNowString & ",Logins=Logins+1 where username='" & username & "'")
            Set Rs = Nothing
            Call ()
             "<script>='" & (11) & "admin_index.asp'</script>"
            End If
        End If
    End Sub
End Class %>