<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>登录、注册</title>
</head>
<body>
<form action="conn.asp" method="post" name="form" target="_parent">
<table width="345" height="124" border="1">
<tr>
<td colspan="2"><div align="center">会员登录</div></td>
</tr>
<tr>
<td width="111"><div align="right">用户名</div></td>
<td width="218"><input type="text" name="use_zh" /></td>
</tr>
<tr>
<td><div align="right">密码</div></td>
<td><input type="password" name="use_mm" /></td>
</tr>
<tr>
<td colspan="2"><button type="submit">提交</button><button type="reset">清空</button></td>
</tr>
</table>
</form>
<form action="zc.asp" method="post" name="form" target="_parent">
<table width="345" height="124" border="1">
<tr>
<td colspan="2"><div align="center">会员登录</div></td>
</tr>
<tr>
<td width="111"><div align="right">用户名</div></td>
<td width="218"><input type="text" name="use_zh" /></td>
</tr>
<tr>
<td><div align="right">密码</div></td>
<td><input type="password" name="use_mm" /></td>
</tr>
<tr>
<td colspan="2"><button type="submit">提交</button><button type="reset">清空</button></td>
</tr>
</table>
</form>
</body>
</html>
登录验证页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>登录处理页面</title>
</head>
<body>
<%
set conn=server.CreateObject("adodb.connection")
sql="provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("zc_dl.mdb")
conn.open(sql) '打开数据库
yh=request.Form("use_zh")
mm=request.Form("use_mm") '接收登录页面的用户名和密码
set rs=server.CreateObject("adodb.recordset")
sqll="select * from a1 where use_zh='"&yh&"' and use_mm='"&mm&"'" '查找数据库中是否有匹配的用户名和密码
rs.open sqll,conn,1,3
if rs.Eof then '如果没有将提示以下的信息并返回登录页面
%>
<script language="javascript">
{
alert("用户名、密码不正确");
window.location.href="index.asp"
}
</script>
<% '匹配成功返回以下以下内容并结束判断语句
else
session("yh")=yh
session("by")=rs("bh")
response.Write("欢迎光临")
response.Write(session("yh"))
end if
%>
</body>
</html>
注册验证页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>注册处理页面</title>
</head>
<body>
<%
set conn=server.CreateObject("adodb.connection")
sql="provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("zc_dl.mdb")
conn.open(sql) '连接数据库
yh=request.Form("use_zh")
mm=request.Form("use_mm") '接收注册页面的用户名和密码
set rs=server.CreateObject("adodb.recordset")
sqll="select * from a1"
rs.open sqll,conn,1,3 '打到zc_dl.mdb文件中a1表
rs.addnew
rs("use_zh")=yh
rs("use_mm")=mm
rs.update ' 将接收到的用户名和密码写入a1表
rs.close
set rs=nothing '关闭数据库
%>
<script>
{
alert("注册成功,帮您转回登录页面");
window.location.href="index.asp"
} /*提示注册成功*/
</script>
</body>
</html>
数据库文件名为:zc_dl.mdb
保存的表名为:a1
表字段名包括:bh(自动编号) use_zh(文本) use_mm(文本)
我也刚刚学,相互学习下 *><*