asp 和access系统 求判断学号 登录密码正确与否的ASP代码

如题所述

第1个回答  2012-04-20
给你个案例:
<%
Admin_yg_pwd=md5(Admin_yg_pwd,16)'使用amd5加密算法转换密码-------
sqlstring="select * from Admin where AdminName='"&gName&"'"
set rs_login=server.CreateObject("adodb.recordset")
rs_login.open sqlstring,conn,1,1
if not rs_login.eof then
if Admin_yg_pwd=rs_login("AdminPassword") then
Session("AdminName")=gName
Session("Authority")=rs_login("Authority")
Session("LoginCount")=rs_login("LoginCount")
Session("LastTime")=rs_login("LastTime")
rs_login.close
set rs_login=nothing
'更新登陆的次数-----------------------------------
sqlstr_up="update [Admin] set LoginCount=LoginCount+1 where AdminName='"&gName&"'"
conn.execute sqlstr_up

Response.Redirect("main.html")
else
go_back "您填写的密码错误,请核实后登录!"
end if
%>
第2个回答  2012-04-20
<%
no=replace(request("no"),"'","")
pwd=replace(request("pwd"),"'","")
sql="select * from admin where no='"&no&"' and pwd='"&pwd&"'"
set rs=conn.execute(sql)
if (not rs.eof) and (not rs.bof) then
response.write "登录成功"
else
response.write "登录失败"
response.end
end if
%>本回答被网友采纳