📄 login
字号:
Private blnError
Private strReason
Public Sub main()
If MyKernel.Env("REQUEST_METHOD") = "POST" Then
Call doPost
Else
Call doGet
End If
End Sub
Private Sub doGet()
MyIO.Echo "<html>"
MyIO.Echo "<head>"
MyIO.Echo "<meta http-equiv=""cache-control"" content=""no-cache"" />"
MyIO.Echo "<meta http-equiv=""cache-control"" content=""max-age=0"" />"
MyIO.Echo "<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"" />"
MyIO.Echo "<title>" & MyKernel.Env("WM_VNAME") & " - 管理员登录</title>"
MyIO.Echo "<link rel=""stylesheet"" href=""images/xw.css"" />"
MyIO.Echo "<script language=""javascript"" src=""jspp/jspp.js""></script>"
MyIO.Echo "<script language=""javascript"">"
MyIO.Echo "if (top != self)"
MyIO.Echo "{"
MyIO.Echo "top.location = location.href;"
MyIO.Echo "}"
MyIO.Echo "else"
MyIO.Echo "{"
MyIO.Echo "jspp.Caption = """ & MyKernel.Env("ProName") & """;"
MyIO.Echo "jspp.using(""mocom.WAPmo.Kernel"");"
MyIO.Echo "}"
MyIO.Echo "</script>"
MyIO.Echo "</head>"
MyIO.Echo "<body class=""system"">"
MyIO.Echo "<form action=""" & MyKernel.Env("SCRIPT_NAME") & """ method=""post"">"
MyIO.Echo "<table border=""0"" cellpadding=""0"" cellspacing=""0"" style=""width:100%;height:100%"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td align=""center"" valign=""middle"">"
MyIO.Echo "<table width=""300"" border=""1"" cellpadding=""2"" cellspacing=""0"" bordercolor=""#000000"" style=""border-collapse:collapse"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td class=""winT0"" colspan=""2""><b>" & MyKernel.Env("WM_VNAME") & " 管理员登录</b></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td width=""100"" align=""right"">帐 号</td>"
MyIO.Echo "<td width=""200""><input type=""text"" name=""UserId"" class=""txt"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td align=""right"">密 码</td>"
MyIO.Echo "<td><input type=""password"" name=""Passwd"" class=""txt"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td align=""right"">验证码</td>"
MyIO.Echo "<td><input type=""text"" name=""Code"" class=""txt"" size=""5"" maxlength=""5"" /> <img src=""code.asp"" border=""0"" align=""absMiddle"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td colspan=""2"" align=""center""><input type=""submit"" value=""确 定"" class=""btn"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</form>"
MyIO.Echo "</body>"
MyIO.Echo "</html>"
End Sub
Private Sub doPost()
Dim strName, strPass
Dim strCode
Dim rs, strSQL
strName = Trim(Request.Form("UserId"))
strPass = Trim(Request.Form("Passwd"))
strCode = Trim(Request.Form("Code"))
blnError = True
If strName = "" Then
strReason = "请输入管理员帐号"
ElseIf strPass = "" Then
strReason = "请输入管理员密码"
ElseIf strCode = "" Then
strReason = "请输入验证码"
ElseIf strCode <> Session.Contents("Code") Then
strReason = "验证码错误"
Else
strSQL = getLimitSQL(1, "*", T_ADMIN, "NAME='$(Name)'", "", "")
strSQL = Replace(strSQL, "$(Name)", SafeString(strName))
Set rs = MyKernel.DB.Query(strSQL, adOpenKeyset, adLockOptimistic, adCmdText)
If rs.EOF Then
strReason = "错误的帐号或密码"
ElseIf rs("Passwd") <> MD5(strPass) Then
strReason = "错误的帐号或密码"
ElseIf rs("Forbid") = 1 Then
strReason = "该帐号已被超级管理员禁用"
Else
blnError = False
strReason = "登录成功"
rs("LoginCount") = rs("LoginCount") + 1
rs("Outime") = getTime(Now())
rs.Update
Dim objCookie
Set objCookie = MyKernel.Cookie("WAPmo.Admin")
objCookie("Name") = strName
objCookie("Passwd") = strPass
objCookie("Power") = MyKernel.DB.getRecord(getLimitSQL(1, "Power", T_ADMIN_GROUP, "SEQID=" & rs("GroupId"), "", ""))
Set objCookie = Nothing
End If
rs.Close
Set rs = Nothing
End If
MyIO.Echo "<html>"
MyIO.Echo "<head>"
MyIO.Echo "<meta http-equiv=""cache-control"" content=""no-cache"" />"
MyIO.Echo "<meta http-equiv=""cache-control"" content=""max-age=0"" />"
MyIO.Echo "<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"" />"
If Not blnError Then
MyIO.Echo "<meta http-equiv=""refresh"" content=""1;url=admin.asp"" />"
End If
MyIO.Echo "<title>" & MyKernel.Env("WM_VNAME") & " - 管理员登录</title>"
MyIO.Echo "<link rel=""stylesheet"" href=""images/xw.css"" />"
MyIO.Echo "</head>"
MyIO.Echo "<body class=""system"">"
MyIO.Echo "<table border=""0"" cellpadding=""0"" cellspacing=""0"" style=""width:100%;height:100%"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td align=""center"" valign=""middle"">"
MyIO.Echo "<table width=""300"" border=""1"" cellpadding=""2"" cellspacing=""0"" bordercolor=""#000000"" style=""border-collapse:collapse"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td class=""winT0""><b>" & MyKernel.Env("WM_VNAME") & " 管理员登录</b></td>"
MyIO.Echo "</tr>"
If Not blnError Then
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td align=""center"">"
MyIO.Echo "<font color=""#0000FF"">" & strReason & "</font><br/>"
MyIO.Echo "如果您的浏览器不支持重定向,请<a href=""admin.asp"" target=""_top"">点此进入</a>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
Else
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td align=""center""><font color=""#FF0000"">登录失败:" & strReason & "</font></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td align=""center""><input type=""button"" value=""返 回"" class=""btn"" onclick=""location.replace('" & MyKernel.Env("SCRIPT_NAME") & "')"" /></td>"
MyIO.Echo "</tr>"
End If
MyIO.Echo "</table>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</body>"
MyIO.Echo "</html>"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -