Online "Shop" DIY (3)

Source: Internet
Author: User
Tags exit chr empty generator interface trim zip visual studio
Buy.asp
<HTML>

<HEAD>

<title> Shopping Blue </title>

<meta name= "generator" content= "Microsoft Visual Studio 6.0" >

</HEAD>

<body bgcolor=lightcyan>

<p align=center>
Src= "Http://edu.cnzz.cn/NewsInfo/file://C:/InetPub/wwwroot/images/title.jpg" ><br>

<body bgcolor=lightcyan>

<form action=buy.asp method=post>

<script language=vbscript>

function ID (MYSTR)

Pos=0

For I=1 to Len (mystr)

If mid (mystr,i,1) = "'" Then

If Pos=0 Then

Id=left (mystr,i-1)

Exit For

End If

End If

Next

End Function

 

</script>

<%

function ID (MYSTR)

Pos=0

For I=1 to Len (mystr)

If mid (mystr,i,1) = "'" Then

If Pos=0 Then

Id=left (mystr,i-1)

Exit For

End If

End If

Next

End Function

function BookName (MYSTR)

Pos=0

For I=1 to Len (mystr)

If mid (mystr,i,1) = "'" Then

If Pos=0 Then

Pos=pos+1

Else

Bookname=mid (Mystr,len (name) +2,i-2-len (ID))

Exit For

End If

End If

Next

End Function

function Price (MYSTR)

For i= Len (mystr) to 1 step-1

If mid (mystr,i,1) = "'" Then

If Pos=0 Then

Price=right (Mystr,len (mystr)-i)

Exit For

End If

End If

Next

End Function

Select Case Request.QueryString ("Name")

Case "View"

Response.Write "Browsing"

If session ("num") = "" Then

Response.Write "There is no selected bibliography in the current shopping basket!" "

Else

NUM=CLNG (Session ("num"))

Response.Write "<table border=1><tr><td> ISBN </td><td> title </td><td> Unit Price
</td><td> Quantity </td><td> Subtotal </td></tr> "

Session ("Sum") =0

For i=0 to Num

Session ("Sum") =session ("sum") +session ("Sum_" & CStr (i))

Response.Write "<tr><td>" & Session ("Id_" & CStr (i)) & "</td><td>" &
Session ("Bookname_" & CStr (i)) & "</td><td>" & Session ("Price_" & CStr
(i) & "</td><td><input type=text size=5 name=txtnum" & CStr (i) & "
Value= "& Session (" Num_ "& CStr (i)) &" ><td> "& Session (" Sum_ "& CStr
(i) & "</td></td></tr>"

Next

Response.Write "</table>"

Response.Write "Total Purchase Amount:" & Session ("Sum")

End If

Case ""

Response.Write "Modify on this page"

NUM=CLNG (Session ("num"))

For i=0 to Num

Session ("Num_" & CStr (i)) = (Request.Form ("Txtnum" & CStr (i))

Session ("Sum_" & CStr (i)) =session ("Num_" & CStr (i)) *session ("Price_"
& CStr (i))

Next

Response.Write "<table border=1><tr><td> ISBN </td><td> title </td><td> Unit Price
</td><td> Quantity </td><td> Subtotal </td></tr> "

Session ("Sum") =0

For i=0 to Num

Session ("Sum") =session ("sum") +session ("Sum_" & CStr (i))

Response.Write "<tr><td>" & Session ("Id_" & CStr (i)) & "</td><td>" &
Session ("Bookname_" & CStr (i)) & "</td><td>" & Session ("Price_" & CStr
(i) & "</td><td><input type=text size=5 name=txtnum" & CStr (i) & "
Value= "& Session (" Num_ "& CStr (i)) &" ><td> "& Session (" Sum_ "& CStr
(i) & "</td></td></tr>"

Next

Response.Write "</table>"

Response.Write "Total Purchase Amount:" & Session ("Sum")

Case Else

Response.Write "Increase"

If session ("num") = "" Then

Session ("num") =0

Else

Session ("Num") =CLNG (Session ("num")) +1

End If

NUM=CLNG (Session ("num"))

Name= (Request.QueryString ("Name"))

Session ("Id_" & CStr (num)) =id (name)

Session ("Bookname_" & CStr (num)) =bookname (name)

Session ("Price_" & CStr (num)) =price (name)

Session ("Sum_" & CStr (num)) =price (name)

Session ("Num_" & CStr (num)) =1

Response.Write "<table border=1><tr><td> ISBN </td><td> title </td><td> Unit Price
</td><td> Quantity </td><td> Subtotal </td></tr> "

Session ("Sum") =0

For i=0 to Num

Session ("Sum") =session ("sum") +session ("Sum_" & CStr (i))

Response.Write "<tr><td>" & Session ("Id_" & CStr (i)) & "</td><td>" &
Session ("Bookname_" & CStr (i)) & "</td><td>" & Session ("Price_" & CStr
(i) & "</td><td><input type=text size=5 name=txtnum" & CStr (i) & "
Value= "& Session (" Num_ "& CStr (i)) &" ><td> "& Session (" Sum_ "& CStr
(i) & "</td></td></tr>"

Next

Response.Write "</table>"

Response.Write "Total Purchase Amount:" & Session ("Sum")

End Select

%>

<p><input type=submit value= "Modify shopping blue" ><input Type=button value= "return
Back to "onclick=window.location.href=" index.asp?flag=<% =session ("flag")%
> "></p>

</form>

</BODY>

</HTML>

Its operating interface is as follows:

The total amount is shown below, and the quantity purchased can be changed.

In.asp
<%@ Language=vbscript%>

<%

If Request.Form ("txtuser") = "" or Request.Form ("txtpwd") = "" Then

Response.Write "Username or password is blank, please re-enter, if you do not register, select the note
Book! "

Else

Set Rs=server. CreateObject ("Adodb.recordset")

Rs. Open "SELECT * from info where id= '" & Request.Form ("Txtuser")
& "'", "dsn=sqlsales; Uid=sa ", 3,3

If Rs. RecordCount =0 Then

Response.Write "This member number does not exist!" "

Else

If Trim (Rs. Fields ("PWD")) <>trim (Request.Form ("Txtpwd")) Then

Response.Write "The password is incorrect! "

Response.Write Rs. Fields ("ID") & "<br>"

Response.Write Rs. Fields ("PWD") & "<br>"

Response.Write Request.Form ("Txtpwd")

Else

Session ("UserID") =rs. Fields ("ID")

Session ("UserName") =rs. Fields ("Name")

Response.Redirect "Index.asp"

' Response.Write Rs. Fields ("ID") & "<br>"

' Response.Write Rs. Fields ("PWD") & "<br>"

"Response.Write" Welcome!

End If

End If

Rs. Close

End If

%>

<HTML>

<HEAD>

<meta name= "generator" content= "Microsoft Visual Studio 6.0" >

</HEAD>

<BODY>

</BODY>

</HTML>

This procedure is used to detect the legality of a login.

Registry.asp
<%@ Language=vbscript%>

<%

If Request.Form ("txtid") = "" and Request.Form ("txtpwd") = "" and
Request.Form ("txtPWD1") = "" And _

Request.Form ("txtname") = "" and Request.Form ("TXTSFZ") = "" and
Request.Form ("txtemail") = "" And _

Request.Form ("txtadd") = "" and Request.Form ("txtpost") = "" and
Request.Form ("txtphone") = "" Then

Response.Write "Please fill in the following carefully:"

Else

If Request.Form ("txtid") = "" Then

Response.Write "User name is empty, please fill in again!" & "<br>"

ElseIf Request.Form ("txtpwd") = "" Then

Response.Write "Password is blank, please fill in again!" & "<br>"

ElseIf Request.Form ("txtPWD1") = "" Then

Response.Write "Password checksum is empty, please fill in!" & "<br>"

ElseIf Request.Form ("txtname") = "" Then

Response.Write "Name is blank, please fill in!" & "<br>"

ElseIf Request.Form ("txtadd") = "" Then

Response.Write "Contact address is empty, please fill in again!" & "<br>"

ElseIf Request.Form ("txtpost") = "" Then

Response.Write "Zip code is empty, please fill it out again!" & "<br>"

ElseIf Trim (Request.Form ("Txtpwd")) <>trim (Request.Form ("txtPWD1"))
Then

Response.Write "Password bit and check bit inconsistent, please re-enter!" "&" <br> "

Else

Set Rs=server. CreateObject ("ADODB.") Recordset ")

Rs. Open "SELECT * from info where id= '" & Trim (Request.Form ("txtID"))
& "'", "dsn=sqlsales; Uid=sa; ", 3,3

' Rs. Open "SELECT * from info where id=" & Chr (+) & "Yuaiwu" & CHR
(a), "dsn=sqlsales; Uid=sa; ", 3,3

If Rs. RecordCount <>0 Then

Response.Write "This user is registered, please select another user name:"

Else

Dim fld (7)

Dim value (7)

FLD (0) = "ID"

FLD (1) = "Name"

FLD (2) = "PWD"

FLD (3) = "Email"

FLD (4) = "Address"

FLD (5) = "Phone"

FLD (6) = "POST"

FLD (7) = "SFZ"

Value (0) =request.form ("txtID")

Value (1) =request.form ("Txtname")

Value (2) =request.form ("Txtpwd")

Value (3) =request.form ("Txtemail")

Value (4) =request.form ("Txtadd")

Value (5) =request.form ("Txtphone")

Value (6) =request.form ("Txtpost")

Value (7) =request.form ("Txtsfz")

Rs. AddNew Fld,value

Rs. Update

End If

Rs. Close

End If

End If

%>

<HTML>

<HEAD>

<meta name= "generator" content= "Microsoft Visual Studio 6.0" >

</HEAD>

<body bgcolor=oldlace>

<p Align=center><font size=6 color=midnightblue> member Application </font></p>

<P>

<form action= "registry.asp" method= "POST" >

<table border=1 cellpadding=0 cellspacing=0 width= "100%" >

<TR>

&LT;TD bgcolor=bisque> User Name </TD>

<td><input Id=txtid Name=txtid

Style= "HEIGHT:22PX; width:275px ">**</TD></TR>

<TR>

&LT;TD bgcolor=bisque> Password </TD>

<td><input Id=password1 Name=txtpwd

Type=password

Style= "HEIGHT:22PX; Width:274px ">**</TD></TR>

<TR>

&LT;TD bgcolor=bisque> Confirmation </TD>

<td><input Id=password2 NAME=TXTPWD1

Type=password

Style= "HEIGHT:22PX; width:275px ">**</TD></TR>

<TR>

&LT;TD bgcolor=bisque> name </TD>

<td><input id=text2 Name=txtname

Style= "HEIGHT:22PX; Width:274px ">**</TD></TR>

<TR>

&LT;TD bgcolor=bisque> ID Number </TD>

<td><input Id=text3 NAME=TXTSFZ

Style= "HEIGHT:22PX; Width:274px "></TD></TR>

<TR>

&LT;TD bgcolor=bisque>email</td>

<td><input ID=TEXT4 Name=txtemail

Style= "HEIGHT:22PX; Width:273px "></TD></TR>

<TR>

&LT;TD bgcolor=bisque> Contact Address:</td>

<td><input ID=TEXT5 Name=txtadd

Style= "HEIGHT:22PX; width:272px ">**</TD></TR>

<TR>

&LT;TD bgcolor=bisque> zip code:</td>

<td><input Id=text6

Name=txtpost

Style= "HEIGHT:22PX; width:270px ">**</TD></TR>

<TR>

&LT;TD bgcolor=bisque> Contact Tel:</td>

<td><input ID=TEXT5 Name=txtphone

Style= "HEIGHT:22PX; width:270px "></TD></TR>

</TABLE></P>

<p align=center><input id=submit1 name=cmdsubmit type=submit value= indeed
Recognize ><input id=reset1 name=cmdcancel type=reset value= Cancel ></P></FORM>

<p><font color=orangered> Please note:</font></p>

<UL>

<li><font color=orangered> with * * Number of columns must be filled out, the other columns can not
Fill </FONT>

<li><font color=orangered> above information should be filled out truthfully so that we can get in time with you
Department </FONT></LI></UL>

<P> </P>

</BODY></HTML>



This login interface is similar to most online login new users.

Summary:
 

Several programs have done a brief explanation, of course, the program is very simple to do, there are many features do not
Or to be perfect, but it has demonstrated a simple example, here for your reference only. If you are interested,
Can put the above procedure to try, wish everybody success!


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.