Super simple code, suitable for getting started, with 6 files, of which data.mdb is the database file, enter.htm is the login interface, and ent_submit.asp is used to determine whether the login can be successful. File, login.asp is the page that jumps to after successful login, register.htm is the interface for registering members, and reg_submit.asp is the file that processes registration information.
1.enter.htm file
"http: //www.w3.org/TR/html4/loose.dtd">
< /p>
2.ent_submit.asp file
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
set conn=server.createobject("adodb.connection") p>
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("data.mdb")
username=request.form("username ")
password=request.
form("password")
sql="select * from user where username='"+username+"' and password='"+password+"'"
set rs=server .CreateObject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof then
response.Write(" ")
else
response.Write ("")
response.redirect"login.asp"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
3.login.asp file
Successful login and go to this page
4.register.htm file
"http://www.w3. org/TR/html4/loose.dtd">
5.reg_submit.asp file p>
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)} ;dbq="&server.mappath("data.mdb")
username=request.form("username")
password=request.form("password")
p>exec="select * from user where username='"&username&"'"
set rs=server.createobject("adodb.recordset")
rs. open exec,conn,1,1
if username="" or password="" then
response.Write("")
else
if not rs.eof then
response.Write("")
else
sql="insert into user(username,password) values('"+username+"','"+password+" ')"
conn.execute sql
response.write("")< /p>
end if
end if
rs.close
set rs=nothing
conn.close p>
set conn=nothing
%>
6.data.mdb file
This requires you to create a file named data.mdb yourself ACCESS database. If ACCESS is not installed, you need to install it first, and then create a table named USER in data.mdb. The table fields are as follows:
id: automatic number
username :Text type
password:Text type