📄 user_log.asp
字号:
<!--#include file="../inc/md5.asp"--><%
Select Case request.querystring("info")
Case "log"
Call log()
Case "in"
Call loin()
Case "out"
Call loout()
Case "login"
Call login()
Case "loging"
Call loging()
end select
%><%Sub log()%>
<table cellspacing="1" cellpadding="4" width="100%" bgcolor="#ffffff" border="0">
<tr bgcolor="#588fc7">
<td colspan="4" height="30" class="head"><font color="#FFFFFF">用户登陆</font></td>
</tr>
<tr>
<td bgcolor="#F7F7F7" align="center">
<form action="user_log.asp?info=login" method="post" name="form1">
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="2" bgcolor="#FFFFFF">
<tr bgcolor="#F7F7F7">
<td width="40%" height="34" align="right" valign="middle" bgcolor="#F7F7F7">
<b>用户名称:</b><br>
</td>
<td width="60%">
<input name="UserName" type="text" id="UserName" size="20" class="form" maxlength="16"></td>
</tr>
<tr bgcolor="#F7F7F7">
<td height="36" align="right" valign="middle" bgcolor="#F7F7F7">
<strong>用户密码:</strong><br>
</td>
<td>
<input name="Userpass" type="password" class="form" id="Userpass" size="20" maxlength="23">
</td>
</tr>
<%if WebUserLOGLOCKNum=1 then
randomize
randm=Int((900000*rnd)+100000)
response.write "<tr><td align=right><b>验证码:</td><td><input name=randm1 type=text class=form size=10 maxlength=20><input type=hidden name=randm2 value="&randm&">"
response.write "<span style='font-family: Georgia;border: 1 solid #808080;background-color: #e8e8e8'> <b>"&randm&"</b></span></td></tr>"
end if%>
<tr align="center" valign="bottom" bgcolor="#F7F7F7">
<td height="34" colspan="2">
<input type="submit" class="button" value="确认提交">
<input type="reset" class="button" value="清除重写">
<input onclick="javascript:location.href='user.asp?info=reg'" type="button" class="button" value="注册用户">
</td>
</tr>
</table>
</form>
<input onclick="javascript:location.href='index.asp'" type="button" class="button" value="返回首页"><br>
<br>
</td>
</tr>
</table>
<%end sub%>
<!-------------------------------------------------------------------------------------->
<%Sub loin()%>
<table cellspacing="1" cellpadding="4" width="100%" bgcolor="#ffffff" border="0">
<tr bgcolor="#588fc7">
<td colspan="4" height="30" class="head"><font color="#FFFFFF">用户登陆</font></td>
</tr>
<tr>
<td bgcolor="#F7F7F7" align="center">
<form action="user_log.asp?info=loging" method="post" name="form">
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="2" bgcolor="#FFFFFF">
<tr bgcolor="#F7F7F7">
<td width="40%" height="34" align="right" valign="middle" bgcolor="#F7F7F7">
<b>用户名称:</b><br>
</td>
<td width="60%">
<input name="UserName" type="text" id="UserName" size="20" class="form" maxlength="16"></td>
</tr>
<tr bgcolor="#F7F7F7">
<td height="36" align="right" valign="middle" bgcolor="#F7F7F7">
<strong>用户密码:</strong><br>
</td>
<td>
<input name="Userpass" type="password" class="form" id="Userpass" size="20" maxlength="23">
</td>
</tr>
<%if WebUserLOGLOCKNum=1 then
randomize
randm=Int((900000*rnd)+100000)
response.write "<tr><td align=right><b>验证码:</td><td><input name=randm1 type=text class=form size=10 maxlength=20><input type=hidden name=randm2 value="&randm&">"
response.write "<span style='font-family: Georgia;border: 1 solid #808080;background-color: #e8e8e8'> <b>"&randm&"</b></span></td></tr>"
end if%>
<tr align="center" valign="bottom" bgcolor="#F7F7F7">
<td height="34" colspan="2">
<input type="submit" class="button" value="确认提交">
<input type="reset" class="button" value="清除重写">
<input onclick="javascript:location.href='user.asp?info=reg'" type="button" class="button" value="注册用户">
</td>
</tr>
</table>
</form>
<input onclick="javascript:location.href='index.asp'" type="button" class="button" value="返回首页"><br>
<br>
</td>
</tr>
</table>
<%end sub%>
<!-------------------------------------------------------------------------------------->
<%Sub loout()%>
<%
Response.Cookies("CnEndWeb_User")("log_UserID")=""
Response.Cookies("CnEndWeb_User")("log_UserName")=""
Response.Cookies("CnEndWeb_User")("log_sex")=""
response.redirect(request.servervariables("HTTP_REFERER"))
%>
<%end sub%>
<!-------------------------------------------------------------------------------------->
<%Sub login()
UserName=CheckSql(Request.Form("Username"))
UserPass=CheckSql(Request.Form("Userpass"))
If UserName="" or UserPass="" Then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 请输入用户名和密码。');history.back();</script>")
Response.end
End If
If UserName=UserPass Then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 用户名和密码相同不能登陆。');history.back();</script>")
Response.end
End If
if WebUserLOGLOCKNum=1 then
if request.form("randm1")="" then
response.write "<script language=javascript>alert('请输入验证码!');history.back(-1);</script>"
response.end ()
end if
if request.form("randm1")<>request.form("randm2") then
session("CnendWeb_admin_login")=session("CnendWeb_admin_login")+1
response.write "<script language=javascript>alert('错误:验证码填写错误!');history.back(-1);</script>"
response.end ()
end if
end if
userip1 = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
userip2 = Request.ServerVariables("REMOTE_ADDR")
If userip1 = "" Then
userip = userip2
Else
userip = userip1
End If
set rs=server.createobject("adodb.recordset")
sql="select ID,name,sex,password,LoginTime,logintimes,LockUser,UserPoint,UserVoteCount,UserAcdCount,VoteCount,AcdCount,loginIP from [userinfo] where username='"&UserName&"'"
rs.open sql,conn,1,3
if rs.eof then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 用户名不存在。');history.back();</script>")
Response.end
else
if rs("password")<>Md5(UserPass) then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 密码输入错误。');history.back();</script>")
Response.end
else
if rs("LockUser")=1 then
Response.Write ("<script>alert(' 操作错误! \n\n 您的帐户已被锁定,如果您对您的帐户有异议请联系站长! ');history.back();</script>")
Response.End
else
if cstr(day(date()))<>cstr(day(rs("LoginTime"))) then
rs("logintime")=NOW()
rs("UserPoint")=rs("UserPoint")+5
rs("logintimes")=rs("logintimes")+1
rs("VoteCount")=rs("UserVoteCount")
rs("AcdCount")=rs("UserAcdCount")
rs("loginIP")=userip
else
rs("logintimes")=rs("logintimes")+1
rs("loginIP")=userip
end if
rs.update
End If
end if
end if
Response.Cookies("CnEndWeb_User")("log_UserID")=rs("ID")
Response.Cookies("CnEndWeb_User")("log_UserName")=rs("Name")
Response.Cookies("CnEndWeb_User")("log_sex")=rs("sex")
rs.close
set rs=nothing
response.redirect(request.servervariables("HTTP_REFERER"))
end sub%>
<!-------------------------------------------------------------------------------------->
<%Sub loging()
UserName=replace(trim(Request.Form("Username")),"'","")
UserPass=replace(trim(Request.Form("Userpass")),"'","")
If UserName="" or UserPass="" Then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 请输入用户名和密码。');history.back();</script>")
Response.end
End If
If UserName=UserPass Then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 用户名和密码相同不能登陆。');history.back();</script>")
Response.end
End If
if WebUserLOGLOCKNum=1 then
if request.form("randm1")="" then
response.write "<script language=javascript>alert('请输入验证码!');history.back(-1);</script>"
response.end ()
end if
if request.form("randm1")<>request.form("randm2") then
session("CnendWeb_admin_login")=session("CnendWeb_admin_login")+1
response.write "<script language=javascript>alert('错误:验证码填写错误!');history.back(-1);</script>"
response.end ()
end if
end if
userip1 = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
userip2 = Request.ServerVariables("REMOTE_ADDR")
If userip1 = "" Then
userip = userip2
Else
userip = userip1
End If
set rs=server.createobject("adodb.recordset")
sql="select ID,name,sex,password,LoginTime,logintimes,LockUser,UserPoint,UserVoteCount,UserAcdCount,VoteCount,AcdCount,loginIP from [userinfo] where username='"&UserName&"'"
rs.open sql,conn,1,3
if rs.eof then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 用户名不存在。');history.back();</script>")
Response.end
else
if rs("password")<>Md5(UserPass) then
Response.Write ("<script>alert(' 会员登陆失败!\n\n 密码输入错误。');history.back();</script>")
Response.end
else
if rs("LockUser")=1 then
Response.Write ("<script>alert(' 操作错误! \n\n 您的帐户已被锁定,如果您对您的帐户有异议请联系站长! ');history.back();</script>")
Response.End
else
if cstr(day(date()))<>cstr(day(rs("LoginTime"))) then
rs("logintime")=NOW()
rs("UserPoint")=rs("UserPoint")+5
rs("logintimes")=rs("logintimes")+1
rs("VoteCount")=rs("UserVoteCount")
rs("AcdCount")=rs("UserAcdCount")
rs("loginIP")=userip
else
rs("logintimes")=rs("logintimes")+1
rs("loginIP")=userip
end if
rs.update
End If
end if
end if
Response.Cookies("CnEndWeb_User")("log_UserID")=rs("ID")
Response.Cookies("CnEndWeb_User")("log_UserName")=rs("Name")
Response.Cookies("CnEndWeb_User")("log_sex")=rs("sex")
rs.close
set rs=nothing
response.redirect("user_index.asp?info=index")
end sub%><!-------------------------------------------------------------------------------------->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -