主要代码如下: <%
dim username,password
username=replace(trim(request(\password=md5(replace(trim(request(\set rs=server.CreateObject(\
rs.Open \and password='\if not(rs.bof and rs.eof) then
if password=rs(\then
response.Cookies(cookieName)(\))
response.Cookies(cookieName)(\rs(\
rs(\rs.Update rs.Close set rs=nothing
response.redirect \ else
call MsgBox(\对不起,您的用户名或密码有误!\ end if else
call MsgBox(\对不起,您的用户名或密码有误!\end if %>
4.2 网站首页
网站首页主要实现的功能是图书搜索、查看图书、查看公告、友情链接、帮助、留言板等功能,可以查看最近更新的书籍和叮当推荐的图书,也可以按类进行查找。网站首页如图4-3所示。
15
图4-3 网站首页界面
主要代码如下:
<% rs.open \
id,detail,vipprice,author,desc,price1,price2,name,pic,mark from product order by id desc\
if rs.eof and rs.bof then
response.write \ 对不起,暂时还没有商品!\ end if i=0
do while not rs.eof %>
<% rs.movenext if rs.eof then
response.write \else %>
if i>=5 then exit do
<% i=i+1
if not rs.eof then rs.movenext loop rs.close %>
4.3 图书信息浏览界面
在图书浏览界面,用户可以浏览图书的基本信息,比如作者,版次,出版
16
社,购买次数,浏览次数,页数,出版日期,主要介绍和目录等信息,界面如图4-4所示。
图4-4 图书信息浏览界面
主要代码如下: <% dim id
id=request.QueryString(\dim
prename,company,intro,predate,graph2,description,remarks,price
set rs=server.CreateObject(\rs.open \rs(\rs.update %>
cellspacing=\
目录
17
4.4 购物车界面
系统的购物车界面可以显示自己选定的商品信息及其价格,并挑选需要的商品下订单或者返回首页继续购买。系统的购物车界面如图4-5所示。
图4-5 购物车界面
主要代码如下: <%
dim id,username,action
action=request.QueryString(\
username=trim(request.cookies(cookieName)(\id=request.QueryString(\
set rs=server.CreateObject(\select case action case \conn.execute \actionid=\
response.redirect \rs.open \
18
username='\
if not rs.eof and not rs.bof then
call MsgBox(\对不起,此商品已存在于您的购物车中,不可以重复添加!\
response.end rs.close else rs.close
rs.open \rs.addnew rs(\
rs(\rs(\set rs=nothing
call MsgBox(\商品成功添加到你的购物篮!\response.end end if end select
rs.open\ce1,product.price2,product.discount from product inner join orders on product.id=orders.id where
orders.username='\orders.state=6\
%>
4.5 提交订单界面
在提交界面显示订单号、商品名称、商品价格、以及用户相关信息和送货方式等,提交订单界面如图4-6所示。
图4-6 提交订单界面
19