谁能帮我写个ASP+ACCESS的用户登录的代码啊
最好详细一点的,谢谢喽
參考答案:代码太多,这里放不下..另外还要配合access跟本没办法跟贴回答.你Q我.5789243
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
default.asp
---------------------------------
<form name="form1" method="post" action="chklogin.asp">
<label>
用户名:
<input type="text" name="UserName">
密码:
</label>
<input type="password" name="PassWord">
<input type="submit" value="登 录">
</form>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
chklogin.asp
-----------------------------------------
<%
dim conn
dim connstr
dim db
db="G6r45jd43.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn.Open connstr
username=Request.form("username")
password = Request("password")
VerifyCode = Replace(Trim(Request("VerifyCode")),"'","")
if UserName = "" or PassWord = "" then
Response.Write("<script>alert(""错误:\n请填写完整用户名和密码--"&Copyright&""");location.href=""index.htm"";</script>")
Response.End
end if
set rs = server.createobject("adodb.recordset")
sql="select * from admin where user='"&username&"'and pass='"&password&"'"
rs.open sql,conn,1,3
if not rs.EOF then
rs.Update
Session("AdminID")=rs("id")
Session("IsAdmin")=true
Session.timeout=900
Response.Redirect ("MapInternet.asp")
else
Response.Write("<script>alert(""错误:\n您的用户名和密码错误,请重新输入--"&Copyright&""");location.href=""default.asp"";</script>")
Response.End
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>