Traditional Culture Encyclopedia - Travel guide - Seek ASP simple source code!
Seek ASP simple source code!
1.enter.htm file
& lt! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 1 Transitional//EN "
" http://www . w3 . org/TR/html 4/loose . dtd " & gt;
& lthtml & gt
& lthead & gt
& ltmeta http-equiv = " Content-Type " Content = " text/html; charset=gb23 12 " >
& lttitle & gt untitled document
& lt/head & gt;
& ltbody & gt
& ltform name = " form 1 " method = " post " action = " ent _ submit . ASP " >
& ltp & gt& lt/p & gt;
& ltp> User Name:
& ltinput name = " username " type = " text " id = " username " size = " 20 " >
& lt/p & gt;
& ltp> secret code:
& lt enter name = "password" type = "password" id = "password" size = "16" >
& lt/p & gt;
& ltp & gt
& lt enter type = "submit" name = "submit" value = "login" >
& ltahref = "register.htm"> Register as a member.
& lt/form & gt;
& lt/body & gt;
& lt/html & gt;
2.ent_submit.asp file
& lt% @ LANGUAGE = " VBSCRIPT " code page = " 936 " % & gt;
& lt! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 1 Transitional//EN " " http://www . w3 . org/TR/HTML 4/loose . DTD " & gt;
& lthtml & gt
& lthead & gt
& ltmeta http-equiv = " Content-Type " Content = " text/html; charset=gb23 12 " >
& lttitle & gt untitled document
& lt/head & gt;
& ltbody & gt
& lt%
set conn = server . createobject(" adodb . connection ")
conn . open " driver = { Microsoft access driver(*。 MDB)}; dbq = " & ampserver.mappath("data.mdb ")
User name =request.form ("user name")
password = request . form(" password ")
SQL = " select * from user where username = ' "+username+" ' and password = ' "+password+" ' "
Set rs = server. CreateObject("adodb.recordset ")
Connecticut, 1, 3
If rs.eof, then
Response. Write ("< script & gtAlert ('User name or password is wrong, please re-enter!') ); history . back(- 1)& lt; /script & gt; ")
other
Response. Write ("< Script & gt Alert ("Login successful! " ); history . back(- 1)& lt; /script & gt; ")
response.redirect"login.asp "
If ... it will be over.
Rs off
Set rs = none
Connection closed
Set connection = none
% & gt
& lt/body & gt;
& lt/html & gt;
3.login.asp document
& lt! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 1 Transitional//EN " " http://www . w3 . org/TR/HTML 4/loose . DTD " & gt;
& lthtml & gt
& lthead & gt
& ltmeta http-equiv = " Content-Type " Content = " text/html; charset=gb23 12 " >
& lttitle & gt untitled document
& ltstyle type="text/css " >
& lt! -
. style 1 {
font-size: 18px;
Font thickness: bold;
}
-& gt;
& lt/style & gt;
& lt/head & gt;
& ltbody & gt
& ltdiv align="center " >
& ltp & gt& lt/p & gt;
& ltp & gt& lt/p & gt;
& ltp & gt& lt/p & gt;
& ltp & gt& lt/p & gt;
& ltp class="style 1 "> successfully logged in and went to this page.
& lt/div & gt;
& lt/body & gt;
& lt/html & gt;
4.register.htm document
& lt! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 1 Transitional//EN "
" http://www . w3 . org/TR/html 4/loose . dtd " & gt;
& lthtml & gt
& lthead & gt
& ltmeta http-equiv = " Content-Type " Content = " text/html; charset=gb23 12 " >
& lttitle & gt untitled document
& ltstyle type="text/css " >
& lt! -
. style 1 { font-size: 14px }
-& gt;
& lt/style & gt;
& lt/head & gt;
& ltbody class="style 1 " >
& ltform name = " form 1 " method = " post " action = " reg _ submit . ASP " >
& ltp & gt& lt/p & gt;
& ltp> User Name:
& ltinput name = " username " type = " text " id = " username " size = " 20 " >
& lt/p & gt;
& ltp> secret code:
& lt enter name = "password" type = "password" id = "password" size = "16" >
& lt/p & gt;
& ltp & gt
& lt enter type = "submit" name = "submit" value = "register" >
& ltahref = "enter.htm"> Return to the login page.
& lt/form & gt;
& lt/body & gt;
& lt/html & gt;
5.reg_submit.asp file
& lt%
set conn = server . createobject(" adodb . connection ")
conn . open " driver = { Microsoft access driver(*。 MDB)}; dbq = " & ampserver.mappath("data.mdb ")
User name =request.form ("user name")
password = request . form(" password ")
exec = " select * from user where username = ' " & amp; User name and password "
set RS = server . createobject(" adodb . recordset ")
Connecticut, 1, 1
If username = ""or password = ""then
Response. Write ("< script & gtAlert ('User name or password cannot be empty!' ); history . back()& lt; /script & gt; ")
other
If not, then
Response. Write ("< script & gtAlert ('Sorry, this account has been registered, please re-enter!') ); history . back()& lt; /script & gt; ")
other
Sql="insert into user(username, password) value ("+username+", "+password+") "
Connect. execute sql
response . write(" & lt; Script & gtAlert ('Registration successful!' ); history . back()& lt; /script & gt; ")
If ... it will be over.
If ... it will be over.
Rs off
Set rs = none
Connection closed
Set connection = none
% & gt
6.data.mdb file
This requires you to build an ACCESS database named data.mdb. If you don't need to install ACCESS, please install it first, and then create a table named USER in data.mdb. The table fields are as follows:
Id: automatic numbering
User name: text type
Password: text type
- Previous article:The best travel route in Dazhou, Sichuan
- Next article:A harbinger of dreaming that others are going to travel.
- Related articles
- Avoid tourists and see the islands in the Philippines that can really enjoy beautiful scenery and clean holidays.
- Four-day tour in Guilin
- Urgently ask for information about the magnificent mountains and rivers in China ~ ~ ~ ~ ~
- Friends who have traveled to Thailand, please help me.
- The top ten tourist attractions in Turkey will take you to different Turkey.
- Why did Jay Chou come to Taiyuan?
- Should the price of tickets for tourist attractions increase?
- How to apply for a tourist annual pass in Suqian, Jiangsu
- Tourist attractions around Changzhou Wujin District Must-visit attractions in Changzhou Wujin one-day tour
- Jinan’s 5 scenic tour lines are all equipped with tourist bus opening times