asp+access用戶登錄代碼,其中
huiyuan.mdb數據庫名
pUser213表名
y_username用戶名字段,y_password密碼字段.
login.htm頁面
<head>
<metahttp-equiv=Content-Typecontent=text/html;charset=gb2312>
<title>登錄</title>
</head>
<body>
<p></p>
<formname=form1method=postaction=loginnew.asp>
<tablewidth=200border=1align=centercellpadding=0cellspacing=0>
<tr>
<tdcolspan=2><divalign=center>登錄</div></td>
</tr>
<tr>
<tdwidth=57><divalign=center>用戶名</div></td>
<tdwidth=137valign=top><inputname=usernametype=text
id=usernamesize=25></td>
</tr>
<tr>
<td><divalign=center>密碼</div></td>
<tdvalign=top><inputname=passwordtype=password
id=passwordsize=25></td>
</tr>
<tr>
<tdcolspan=2><divalign=center>
<inputtype=submitname=Submitvalue=提交>
</div></td>
</tr>
</table>
</form>
</body>
</html>
loginnew.asp網頁
<%
dimusername,password
username=request.form(username)
password=request.form(password)
setrs=server.createobject(adodb.recordset)
conn=DBQ=+server.mappath(huiyuan.mdb)+;DefaultDir=;
DRIVER={MicrosoftAccessDriver(*.mdb)};
sql=select*frompUser213wherey_username='&username&'
rs.opensql,conn,1,1
ifrs.eofthen
response.write<script>alert('登錄失敗');history.back();</script>
response.end
else
ifrs(y_password)<>passwordthen
response.write<script>alert('登錄失敗');history.back();</script>
response.end
endif
session(admin)=username
response.write<script>alert('登錄成功');location.href='index.asp'</script>
endif
%>