chklogin.asp

来自「xmuu.NET网址导航 V 3.3 正式版 直接修改后可使用。包括数百网址导航」· ASP 代码 · 共 74 行

ASP
74
字号
<!--#include file="conn.asp"-->
<%
Const sBASE_64_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" 


Function Base64encode(asContents) 
Dim lnPosition 
Dim lsResult 
Dim Char1 
Dim Char2 
Dim Char3 
Dim Char4 
Dim Byte1 
Dim Byte2 
Dim Byte3 
Dim SaveBits1 
Dim SaveBits2 
Dim lsGroupBinary 
Dim lsGroup64 

If Len(asContents) Mod 3 > 0 Then asContents = asContents & String(3 - (Len(asContents) Mod 3), " ") 
lsResult = "" 

For lnPosition = 1 To Len(asContents) Step 3 
lsGroup64 = "" 
lsGroupBinary = Mid(asContents, lnPosition, 3) 

Byte1 = Asc(Mid(lsGroupBinary, 1, 1)): SaveBits1 = Byte1 And 3 
Byte2 = Asc(Mid(lsGroupBinary, 2, 1)): SaveBits2 = Byte2 And 15 
Byte3 = Asc(Mid(lsGroupBinary, 3, 1)) 

Char1 = Mid(sBASE_64_CHARACTERS, ((Byte1 And 252) \ 4) + 1, 1) 
Char2 = Mid(sBASE_64_CHARACTERS, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1) 
Char3 = Mid(sBASE_64_CHARACTERS, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1) 
Char4 = Mid(sBASE_64_CHARACTERS, (Byte3 And 63) + 1, 1) 
lsGroup64 = Char1 & Char2 & Char3 & Char4 

lsResult = lsResult + lsGroup64 
Next 

Base64encode = lsResult 
End Function

username=trim(Request.form("username"))
password=trim(Request.form("password"))
if username<>server.urlencode(username) or password<>server.urlencode(password) then
	response.redirect "index.asp"
end if
if username="" or password="" then Response.Redirect ("index.asp")

set rs=server.createobject("adodb.recordset")
sql="select * from admin where username='"&username&"' and password='"&Base64encode(password)&"'"
rs.open sql,conn,1,3
if not rs.EOF then
	rs("Logincount")=rs("Logincount")+1
	rs("LoginTime")=now()
	rs("LoginIP")=Request.ServerVariables("REMOTE_ADDR")
	rs.Update

	Session("Admin")=rs("username")
	Session("IsAdmin")=true
	Session("level")=rs("level")
	Session("ap")=rs("password")
    Session.timeout=90
	Response.Redirect("admin.asp")
else
	Response.Write "请输入正确的管理员名字和密码!"
	Response.End 
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?