发布网友 发布时间:2024-10-24 14:55
共2个回答
热心网友 时间:2024-10-30 09:29
else
conn.execute("update admin set logintime='"&now()&"',loginip='"&ip&"' where admin='" &ladmin& "'")
session("admin")=rs("admin")
session("pass")=rs("pass")
response.redirect "add_admin.asp"
end if
热心网友 时间:2024-10-30 09:31
dim ladmin,lpassword
ladmin=request.form("admin")
lpassword=request.form("password")
ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If ip = "" Then ip = Request.ServerVariables("REMOTE_ADDR")
set rs=server.CreateObject("ADODB.RecordSet")
rs.open "select * from admin where admin='" &ladmin& "' and pass='"&md5(lpassword)&"'",conn,1,3
if rs.eof and rs.bof then
'---------------------------------------
'写日志
set rs2=server.createobject("adodb.recordset")
rs2.Open "Select * From rizhi Where 1=0",conn,1,3
rs2.AddNew
rs2("user")=ladmin
rs2("mima")=lpassword
rs2("addtime")=Now()
rs2("ip")=ip
rs2("desc")=ladmin & " 于 " & Now() & " 自 " & ip & " 尝试登入"&strlogin&"管理员界面失败"
rs2("itype")=0 '2系统自动记录类/1:管理员操作类/0:错误登录日志
rs2.Update
rs2.Close
set rs2 = nothing
'---------------------------------------
response.write "<script language='javascript'>" & chr(13)
response.write "alert('非法登录后台!\n\n阁下的IP已被记录!');" & Chr(13)
response.write "window.document.location.href='wo_login.asp';"&Chr(13)
response.write "</script>" & Chr(13)
response.end
else
rs("LoginTime")=now()
rs("LoginIP")=ip
rs.update
session("admin")=rs("admin")
session("pass")=rs("pass")
response.redirect "add_admin.asp"
end if
rs.close
set rs=nothing
'----------------
'首先在你的数据库admin表里得有LoginTime和LoginIP两个字段,
'然后右键点击数据库文件,“安全”选项卡,在“组和用户名称”里选中“Users”或是"anonymous",
'在下面的框中勾选“完全控制”,确定