📄 chklogin.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/char.asp"-->
<!--#include file="inc/grade.asp"-->
<!--#include file="inc/theme.asp"-->
<!--#include file="chkuser.asp"-->
<!--#include file="md5.asp"-->
<%
dim rs
dim sql
dim UserIP
dim username
dim userclass
dim password
dim article
sub chkuser()
UserIP=Request.ServerVariables("REMOTE_ADDR")
if request("username")="" then
errmsg=errmsg+"<br>"+"<li>请输入您的用户名。"
founderr=true
else
username=trim(replace(request("username"),"'",""))
end if
if request("password")="" then
errmsg=errmsg+"<br>"+"<li>请输入您的密码。"
founderr=true
else
password=md5(trim(replace(request("password"),"'","")))
end if
'判断更新cookies目录
cookies_path_s=split(Request.ServerVariables("PATH_INFO"),"/")
cookies_path_d=ubound(cookies_path_s)
cookies_path="/"
for i=1 to cookies_path_d-1
if not (cookies_path_s(i)="upload" or cookies_path_s(i)="admin") then cookies_path=cookies_path&cookies_path_s(i)&"/"
next
if cookiepath<>cookies_path then
cookiepath=cookies_path
conn.execute("update config set cookiepath='"&cookiepath&"'")
end if
usercookies=request("CookieDate")
if chkuserlogin(username,password,usercookies,1)=false then
errmsg=errmsg+"<br>"+"<li>您的用户名并不存在,或者您的密码错误,或者您的帐号已被管理员锁定。"
founderr=true
end if
end sub
sub activeuser()
dim membername,memberword,memberclass
membername=request.cookies("aspsky")("username")
memberword=request.cookies("aspsky")("password")
memberclass=request.cookies("aspsky")("userclass")
statuserid=replace(Request.ServerVariables("REMOTE_HOST"),".","")
if session("userid")<>"" then
sql="delete from online where id="&cstr(session("userid"))
Conn.Execute sql
end if
sql="select * from online where username='"&membername&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof and rs.bof then
sql="insert into online(id,username,userclass,ip,startime,lastimebk,lastime,browser,stats,actforip,ComeFrom,actCome) values "&_
"("&statuserid&",'"&membername&"','"&memberclass&"','"&_
Request.ServerVariables("REMOTE_HOST")&"',Now(),Now(),'"&DateToStr(now())&"','"&_
Request.ServerVariables("HTTP_USER_AGENT")&"','论坛首页','"&_
Request.ServerVariables("HTTP_X_FORWARDED_FOR")&"','"&ComeFrom&"','"&actCome&"')"
conn.execute(sql)
else
sql="update online set lastimebk=Now(),lastime='"&DateToStr(now())&"',ComeFrom='"&ComeFrom&"',actCome='"&actCome&"' where username='"&membername&"'"
'response.write sql
conn.execute(sql)
end if
rs.close
set rs=nothing
end sub
stats="用户登陆"
call chkuser()
if founderr then
call nav()
call headline(1)
call error()
else
call nav()
call headline(1)
call success()
end if
call endline()
sub success()
%>
<%if instr(request("comeurl"),"regPost.asp")>0 or instr(request("comeurl"),"login.asp")>0 or instr(request("comeurl"),"chklogin.asp")>0 or trim(request("comeurl"))="" then%>
<meta HTTP-EQUIV=REFRESH CONTENT='4; URL=index.asp'>
<%comeurl="index.asp"%>
<%else%>
<meta HTTP-EQUIV=REFRESH CONTENT='4; URL=<%=request("comeurl")%>'>
<%comeurl=request("comeurl")%>
<%end if%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=TableWidth%> bgcolor=<%=tablebackcolor%> align=center>
<tr>
<td>
<table cellpadding=3 cellspacing=1 border=0 width=100%>
<tr>
<td bgcolor="<%=tableTitleColor%>"><font color="<%=TableFontColor%>"><b>状态:您已经登录成功</b></font></td>
</tr>
<tr><td bgcolor="<%=tablebodycolor%>"><br><ul><li><a href="<%=comeurl%>"><font color="<%=TableContentColor%>">进入讨论区</font></a></li></ul></td></tr>
</table> </td></tr></table>
<%
end sub
%>
<!-- #include file=footer.asp -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -