如何使用asp用户登录代码?
function htm_fn(str)
dim result
result = replace(replace(replace(replace(replace(str,"<","<"),">",">"),"'",""),chr(34),""),";","")
htm_fn = result
end function
If request("login")<>"" then
if request("valpass")=session("ValidateCode") then
set rs=server.createobject("adodb.Recordset")
sql="select id from lei_member where username='"&htm_fn(request("username"))&"' and password='"&htm_fn(request("password"))&"'"
rs.open sql,conn,3,1
if rs.bof or rs.eof then
response.write"<SCRIPT language=JavaScript>alert('密码不正确或无此用户!');"
response.write"this.location.href='index.asp';</SCRIPT>"
else
session("username")=rs("id")
response.write"<SCRIPT language=JavaScript>alert('登录成功!');</script>"
response.Redirect "member.asp"
end if
rs.close
set rs = nothing
else
response.Write "<script>alert('请正确输入验证码')</script>;
End If
本文地址:http://www.45fan.com/dnjc/67855.html