📄 login.asp
字号:
<html>
<!--#include file="head.asp"-->
<title><%=NetName%> - 登录</title>
<body>
<!--#include file="toper.asp"-->
<%
if (Request("action")="chk") then
call LoginCheck
end if
%>
<table width="750" height="5" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
</table>
<table width="750" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align=left><%
if Session("Id")<>"" and Session("UserName")<>"" then
response.write "<br>"
call ShowMenu
response.write "<br>"
end if%></td>
</tr>
</table>
<script>
function checkform2(){
if (document.f.MyName.value==""){
alert("请输入用户名")
document.f.MyName.focus();
return false
}
if (document.f.MyPsw.value==""){
alert("请输入密码");
document.f.MyPsw.focus();
return false
}
if (document.f.CheckCode.value==""){
alert("请输入验证码");
document.f.CheckCode.focus();
return false
}
return true
}
</script>
<table cellspacing="0" cellpadding="0" width="500" align="center" border="0" styel="line-height:200px;">
<%if Session("Id")="" or Session("UserName")="" then%>
<form name="f" onSubmit="return checkform2()" action="login.asp?action=chk" method="post">
<tr>
<td>
<p>· 请输入您的用户名和密码登录控制台。
<br><br>
<%
if session("Errmsg") <> "" then
response.write "· 在尝试处理您的登陆请求时发生了以下错误:<br>"
response.write "<font color=red>"
response.write session("Errmsg")
response.write "</font>"
session("Errmsg") = ""
end if
%>
</p>
<p style="MARGIN: 16px 0px 6px">
用户名:
<input name="MyName" maxlength="90"> <br>
密 码: <input name="MyPsw" type="password" maxlength="90"> [<a href="usergetpass.asp">忘记了密码?</a>]
<br>
验证码: <input name="CheckCode" size="5" maxlength="25"> 请输入
<img src="GetCode.asp"></p>
<p></p>
<br>
<br>
<p>
<input type="submit" value=" 登 录 " name="submit1">
<br>
</p>
</td>
</tr>
</form>
<%end if%>
<%if Session("Id")<>"" and Session("UserName")<>"" then%>
<tr><td styel="line-height:200px;">
· 欢迎您回来 - <SPAN class="User"><%=Session("UserName")%></SPAN>,您目前是“<%=NetName%>”<SPAN class="User"><%=Session("usertype")%></SPAN>!<br>
· 帐号状态:<FONT color=#FF0000><%=Session("Flag")%></Font> 积分模式:<FONT color=#FF0000><%=Session("InType")%></Font><BR>
· 上次登陆时间: <FONT color=#FF0000><%=Session("LastLogin")%></Font> 上次登陆IP: <FONT color=#FF0000><%=Session("LastLoginIP")%></Font><br>
<%=ShowContent%><br><br>
</td></tr>
<%end if%>
</table>
<table width="750" height="5" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
</table>
<!--#include file="foot.asp"-->
</body>
</html>
<%
sub LoginCheck
if Trim(Request("CheckCode"))="" or isnull(Request("CheckCode")) then
session("Errmsg") = session("Errmsg")+" - 请输入附加码。</b>"
exit sub
elseif session("Num")="" then
session("Errmsg") = session("Errmsg")+" - 请不要重复提交,如需重新登陆请返回登陆页面。</b>"
exit sub
elseif Trim(Request("CheckCode"))<>session("Num") then
session("Errmsg") = session("Errmsg")+" - 你输入的附加码和系统产生的不符。"
exit sub
end if
if Trim(Request("MyName")) = "" or Trim(Request("MyPsw")) = "" then
session("Errmsg") = session("Errmsg")+" - 请输入登陆用户名或密码。</li>"
exit sub
else
UserName = checkStr(Request("MyName"))
password = checkStr(Request("MyPsw"))
end if
IP = Request.ServerVariables("LOCAL_ADDR")
Sql = "Select * from Users where UserName='"& UserName &"'"
'on error resume next
Set Rs = conn.execute(Sql)
if Rs.eof and Rs.bof then
Rs.close
Set Rs = nothing
session("Errmsg") = session("Errmsg")+" - 您输入的用户名和密码不正确。</li>"
exit sub
else
if Trim(rs("password"))<>md5(password) then
session("Errmsg") = session("Errmsg")+" - 您输入的用户名和密码不正确。</li>"
exit sub
else
'登录成功,写入SESSION变量
Session("Id")=rs("Id")
Session("UserName")=UserName
Session("LastLoginIP")=rs("LastLoginIP")
Session("LastLogin")=rs("LastLogin")
if rs("Flag")=0 then
'Session("Flag")="等待审核"
Session("Flag")="通过审核"
elseif rs("Flag")=1 then
Session("Flag")="已经认证"
elseif rs("Flag")=2 then
Session("Flag")="已经锁定"
end if
if rs("InType")=0 then
Session("InType")="积分交换"
elseif rs("InType")=1 then
Session("InType")="积分累积"
end if
if rs("OutType")=0 then
Session("OutType")="延迟弹出"
elseif rs("OutType")=1 then
Session("OutType")="退出弹出"
elseif rs("OutType")=2 then
Session("OutType")="暂停弹出"
end if
if rs("IsVip")=0 then
Session("usertype")="免费用户"
else
Session("usertype")="VIP用户"
end if
session.timeout=45
conn.execute("update users set LastLogin=Now(),LastLoginIP='"&IP&"' where UserName='"&UserName&"'")
rs.close
set rs=nothing
response.write "<script>location.href='login.asp'</script>"
end if
end if
end sub
%>
<%
Function ShowContent ()
sql="select Login from Notice"
set rs=conn.execute (sql)
if not rs.eof then
response.write rs(0)
rs.close
end if
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -