1.摘要……………………………………………………………… 3
2.前言……………………………………………………………… 4
3.网站整体功能…………………………………………………… 5
4.网站架构图 ……………………………………………………… 5
5. 数据库结构设计图 …………………………………………… 5
6. 正文 …………………………………………………………… 6
7.附图 …………………………………………………………… 26
8. 结束语 ………………………………………………………… 30
9.参考文献 ……………………………………………………… 30
一、内容摘要
毕业设计目的
通过进行实际的网站架构设计和程序设计,真正掌握并进一步深入了解电子商务的内部原理和程序运行机制,做到学以致用。
毕业设计摘要
本次课程设计取题为sunnybaby(阳光宝贝)数码专卖,通过ASP技术进行构建,数据库为Access,结合CSS进行网站整体布局和界面设计,并综合运用了FLASH等技术,来建设网站。
One. Content Summary
Purpose of Designed to Graduation
Through the actual site structure design and program design, and truly master and further in-depth understanding of e-commerce principles and procedures of internal operational mechanism, to apply what they have learned.
Sunmary of Designed to Graduation
The curriculum design entitled sunnybaby admission (Sunnybaby Baby) Digital Monopoly by ASP technology for construction of the Access database, a web site with CSS overall layout and interface design, and the integrated use of the FLASH technology to build its website.
二、前言
Sunnybaby(阳光宝贝)数码产品专卖采用横向三栏式布局,如图所示:
二级页面与首页布局类似,只是将主体与右侧产品展示合并构成新的主体内容区。
三、网站整体功能
用户注册、登录功能 商品搜索功能 商品评论功能
购物车功能 留言功能 友情链接功能
四、网站架构
五、数据库结构
六、正文关键代码部分
数据库连接代码:(conn.asp)
<%@ LANGUAGE="VBScript.Encode" CodePage="936"%>
<%Response.Buffer=True
Server.ScriptTimeout=90
On Error Resume Next
dbfolder="../database/"
dbname="hidfuhsdfi.mdb"
connstr="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="& Server.MapPath(dbfolder&dbname)
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connstr
If Err Then
set fs=createobject("scripting.filesystemobject")
set ts=fs.createtextfile(server.MapPath("Error/data_"&month(now())&"-"&day(now())&"_"&hour(now())&"-"&minute(now())&"-"&second(now())&".txt"),true)
ts.write Err.Number&":"&Err.Description
ts.close
set ts=Nothing
set fs=Nothing
err.Clear
Set Conn = Nothing
Response.Write "<p style='font-size:9pt' align=center>数据库连接出错!</p>"
Response.Write "<p style='font-size:9pt' align=center>可能出错原因:数据库位置或名称不对、数据库损坏!</p>"
Response.End
End If%><!--#include file="../config.asp"-->
首页代码:(index.asp)
<!--#include file="conn.asp"-->
<!--#include file="IncAsp/redsunny_top.asp"-->
<!--#include file="IncAsp/all_pay.asp"-->
<!--#include file="IncAsp/index_ad1.asp"-->
<!--#include file="IncAsp/index_show.asp"-->
<div align="center">
<table cellpadding="0" cellspacing="0" class="all_t1">
<tr><td class="all_l_td" valign="top">
<!--#include file="IncAsp/redsunny_log.asp"--><div class="d5"></div>
<!--#include file="IncAsp/redsunny_sort.asp"--><div class="d5"></div>
<%showflash ad_img(5),ad_url(5),null,null,null%><div class="d5"></div>
<!--#include file="IncAsp/all_pinpai.asp"--><div class="d5"></div>
<%showflash ad_img(6),ad_url(6),null,null,null%><div class="d5"></div>
<!--#include file="IncAsp/index_link.asp"--><div class="d5"></div>
<%showstat tongj%>
</td>
<td class="all_c_td" valign="top">
<%showad1%><div class="d5"></div>
<%showindex "tj","tjindex","tjindex=1","hw_id DESC",tjindex%><div class="d5"></div>
<%showflash ad_img(1),ad_url(1),null,null,null%><div class="d5"></div>
<%showindex "tm","hot","1=1","hw_buys DESC,hw_id DESC",gun%><div class="d5"></div>
<%showflash ad_img(2),ad_url(2),null,null,null%><div class="d5"></div>
<%showindex "te","tejia","tejia=1","hw_id DESC",tejia%><div class="d5"></div>
<%showflash ad_img(3),ad_url(3),null,null,null%><div class="d10"></div>
<%showpaylogo%>
</td>
<td class="all_r_td" valign="top">
<!--#include file="IncAsp/all_service.asp"--><div class="d5"></div>
<!--#include file="IncAsp/all_news.asp"--><div class="d5"></div>
<!--#include file="IncAsp/all_ph.asp"--><div class="d5"></div>
</td></tr>
</table>
</div>
<!--#include file="IncAsp/redsunny_copy.asp"-->
注册页面代码(login.asp)
<!--#include file="conn.asp"-->
<!--#include file="IncAsp/redsunny_top.asp"-->
<!-- #include file="IncAsp/redsunny_md5.asp" -->
<%
comurl=request("comurl")
if request("action")="login" then
errmeg1="登录名和密码为空!"
errmeg2="登录名和密码不匹配!"
user_name=DelStr(request("user_name"))
user_pass=md5(DelStr(request("user_pass")))
if request("user_name")="" or request("user_pass")="" then
response.Write "<script LANGUAGE='javascript'>alert('"&errmeg1&"');history.go(-1);</script>"
Response.Cookies("redsunny")("user_name")=""
Response.Cookies("redsunny")("user_type")=""
Response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select * from redsunny_user where username='"&user_name&"' and userpass='"&user_pass&"'"
rs.open sql,conn,1,3
if rs.eof then
rs.close
set rs=nothing
response.Write "<script LANGUAGE='javascript'>alert('"&errmeg2&"');history.go(-1);</script>"
Response.Cookies("redsunny")("user_name")=""
Response.Cookies("redsunny")("user_type")=""
Response.end
end if
Response.Cookies("redsunny")("user_name")=rs("username")
Response.Cookies("redsunny")("user_pass")=rs("userpass")
Response.Cookies("redsunny")("user_type")=rs("user_type")
rs("landtime")=now()
rs("user_lastip")=request.servervariables("remote_addr")
rs("degree")=rs("degree")+1
rs.update
rs.close
set rs=nothing
if Request.Cookies("redsunny")("guest")<>"" then
guest=Request.Cookies("redsunny")("guest")
set rs=server.createobject("adodb.recordset")
rs.open "select user_name from redsunny_basket where user_name='"&guest&"' and basket_check=0",conn,1,3
do while not rs.eof
rs("user_name")=request("user_name")
rs.update
rs.movenext
loop
rs.close
set rs=nothing
Response.Cookies("redsunny")("guest")=""
end if
if comurl="" then
comurl="index.asp"
end if
response.redirect comurl
Response.end
elseif request("action")="quit" then
Response.Cookies("redsunny")("user_name")=""
Response.Cookies("redsunny")("user_type")=""
Response.Cookies("redsunny")("user_pass")=""
Response.Cookies("redsunny")("guest")=""
if Request.ServerVariables("Http_Referer")<>"" then
response.redirect ""&Request.ServerVariables("Http_Referer")&""
else
response.redirect "index.asp"
end if
else%>
<div align="center">
<tableborder="0" cellpadding="5" cellspacing="0" width="980" bgcolor="#FFFFFF" height="300">
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="99%" style="border: 1px solid #C0C0C0">
<tr><td height="30" style="border-bottom: 1px solid #E1E1E1" class="fanse"> <IMG src="Skin/<%=redsunny_skin%>/home.gif" border=0 align="absmiddle">
您的位置:
<a class="ser" href="index.asp">首页</a> >> 用户登录 新用户请<a href="reg.asp"><u>点击注册</u></a> 忘记密码请<a href="repass.asp"><u>点击这里</u></a></td></tr>
<%if Request.Cookies("redsunny")("user_name")<>"" then
user_name=Request.Cookies("redsunny")("user_name")%>
<tr><td align="center" height="300">
<table border="0" cellpadding="0" cellspacing="0" width="615" id="table1">
<tr><td colspan="2" background="Skin/<%=redsunny_skin%>/logina1.gif"height="29"></td>
</tr>
<tr>
<td align="center" bgcolor="#F9F9F9">
<img border="0"src="Skin/<%=redsunny_skin%>/logina3.gif" width="143" height="80"></td>
<td bgcolor="#F9F9F9" class="fanse">
<p style="line-height: 150%"><b>提示:<br>
</b><%=user_name%>您好,您已经登录成功!<br>
如果您不是<%=user_name%>,请<a class="ser" href="login.asp?action=quit">退出重新登录</a>!</td></tr><tr><td colspan="2" background="Skin/<%=redsunny_skin%>/logina2.gif" height="29"></td></tr> </table></td></tr>
<%else%>
<form method="POST" name="form1" action="login.asp?action=login">
<input name="comurl" type="hidden" value="<%=comurl%>">
<tr><td align="center" height="300">
<table border="0" cellpadding="0" cellspacing="0" width="615" id="table1">
<tr><td colspan="2" background="Skin/<%=redsunny_skin%>/logina1.gif"height="29"></td>
</tr><tr> <td align="center" bgcolor="#F9F9F9">
<img border="0" src="Skin/<%=redsunny_skin%>/logina3.gif"width="143" height="80"></td>
<td bgcolor="#F9F9F9">
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table2">
<tr>
<td class="fanse" height="30">用 户 名:<input name="user_name" type="text" class=input style="FONT-SIZE: 12px; WIDTH: 110px"></td><td rowspan="2"><input type=image src="Skin/<%=redsunny_skin%>/logina4.gif" name="login"></td>
</tr><tr>
<td class="fanse" height="30">用户密码:<input style="FONT-SIZE: 12px; WIDTH: 110px" type="password" name="user_pass" class=input size="12"></td>
</tr></table></td></tr>
<tr><td colspan="2" background="Skin/<%=redsunny_skin%>/logina2.gif" height="29"> </td></tr>
</table></td></tr></form>
<%end if%>
</table></td></tr></table></div>
<%end if%><!--#include file="IncAsp/redsunny_copy.asp"-->
订单页面代码(Orders.asp)
<!--#include file="conn.asp"-->
<!--#include file="IncAsp/redsunny_top.asp"-->
<div align="center">
<table cellpadding="0" cellspacing="0" class="all_t1">
<tr><td class="all_l_td" valign="top">
<!--#include file="IncAsp/redsunny_log.asp"--><div class="d5"></div>
</td><td valign="top" class="all_c_td">
<table width="99%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="sort"> <IMG src="Skin/<%=redsunny_skin%>/home.gif" border=0 align="absmiddle"> 您的位置: <a href="index.asp">首页</a> >> 我的订单列表</td></tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="useri">
<tr><td height="150">
<%ifRequest.Cookies ("redsunny") ("user_name")="" and Request.Cookies("redsunny")("guest")="" then
response.redirect "login.asp?comurl=orders.asp"
response.end
else
if Request.Cookies("redsunny")("user_name")<>"" then
user_name=Request.Cookies("redsunny")("user_name")
chklogin(user_name)
elseif Request.Cookies("redsunny")("guest")<>"" then
user_name=Request.Cookies("redsunny")("guest")
end if%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td height="30" colspan="5">
<p style="margin:5px; "><a href="orders.asp">所有订单</a>:
<a href="<%=filename%>?zt=1">未处理</a>
<a href="<%=filename%>?zt=0">无效订单</a>
<a href="<%=filename%>?zt=-1">等待付款订单</a>
<a href="<%=filename%>?zt=2">已付款</a>
<a href="<%=filename%>?zt=3">已收款</a>
<a href="<%=filename%>?zt=4">已发货</a>
<a href="<%=filename%>?zt=5">已收货</a></td>
</tr>
<tr>
<td class="cartshowa" width="5"> </td>
<td class="cartshowa">订单号</td>
<td class="cartshowa">日期</td>
<td class="cartshowa">投诉</td>
<td class="cartshowa">状态</td>
</tr>
<%page=request("page")
if page="" then page=1
if not(isnumeric(page)) then page=1
if page<1 then page=1
page=int(page)
zt=request("zt")
set rs=server.createobject("adodb.recordset")
if zt<>"" then
sql="select * from redsunny_sub where sub_name='"&user_name&"' and sub_zt="&zt&" order by sub_id DESC"
else
sql="select * from redsunny_sub where sub_name='"&user_name&"' order by sub_id DESC"
end if
rs.open sql,conn,1,1
if rs.eof then
response.write "<tr><td align=center height=50 colspan=5>暂且没有任何订单</td></tr>"
rs.close
set rs=nothing
else
rs.pagesize=20
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
rs.cachesize=rs.pagesize
i=0
do while not rs.eof and (i<rs.pagesize)
i=i+1 %>
<tr>
<td class="cartshow<%=(i mod 2)%>" width="5"> </td>
<td class="cartshow<%=(I mod 2)%>"><a href="#" οnclick="javascript:window.open
('submore.asp?sub_id=<%=rs("sub_id")%>','newwindow','toolbar=no,scrollbars=yes,resizable=no,top=0,left=0,width=650,height=600');"><%=rs("sub_number")%></a></td>
<tdclass="cartshow<%=(imod2)%>"><%=right(year(rs("sub_date")),2)%><%=month(rs("sub_date"))%>-<%=day(rs("sub_date"))%></td>
<td class="cartshow<%=(i mod 2)%>"><%if rs("sub_tousu")=1 then%>已投诉,管理员尚未处理<%elseif rs("sub_tousu")=2 then%><p style="line-height: 150%; margin-top: 3px; margin-bottom: 3px">投诉:<%=rs("sub_you")%><br>回复:<%=rs("sub_fu")%></p><%else%><a href="#" οnclick="javascript:window.open('tousu.asp?sub_id=<%=rs("sub_id")%>&sub_number=<%=rs("sub_number")%>','newwindow','toolbar=no,scrollbars=yes,resizable=no,top=0,left=0,width=420,height=180');">投诉</a><%end if%></td>
<td class="cartshow<%=(i mod 2)%>">
<%if rs("sub_zt")=0 then response.write "无效订单"%>
<%if rs("sub_zt")=1 then response.write "未处理"%>
<%if rs("sub_zt")=-1 then response.write "已处理等待客户付款"%>
<%if rs("sub_zt")=2 then response.write "已付款等待发货"%>
<%if rs("sub_zt")=3 then response.write "已收款发货中"%>
<%if rs("sub_zt")=4 then response.write "已发货注意收货"%>
<%if rs("sub_zt")=5 then response.write "已收货(归档)"%></td>
</tr>
<%rs.movenext
loop
rs.close
set rs=nothing
end if
%></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td colspan="5" height="30" class="sortb">
<p style="line-height: 150%; margin-left: 10px; margin-right: 5px; margin-top: 5px; margin-bottom: 5px">第<%=page%>页/共<%=totalpage%>页
<%if page-1>0 then%><a href="<%=filename%>?page=<%=page-1%>&zt<%=request("zt")%>">上一页</a><%else%>上一页<%end if%>
<%if page+1 <=totalpage then%><a href="<%=filename%>?page=<%=page+1%>&zt
<%=request("zt")%>">下一页</a><%else%>下一页 <%end if%></td></tr><tr>
<td colspan="5" height="30"><p style="line-height: 150%; margin-left: 10px; margin-right: 5px; margin-top: 5px; margin-bottom: 5px">
提示一:收货后请在订单详情中修改订单状态为已收货,谢谢合作<br>
提示二:点击订单号查看详情<br>
提示三:未收到货或其它订单相关问题,可以进行订单投诉,请说明原因</td></tr></table>
<%end if%>
</td></tr></table>
</td></tr></table></div><!--#include file="IncAsp/redsunny_copy.asp"-->
购物代码(buy.asp)
<!--#include file="conn.asp"-->
<!--#include file="IncAsp/redsunny_top.asp"-->
<div align="center">
<table cellpadding="0" cellspacing="0" class="all_t1">
<tr><td class="all_l_td" valign="top">
<!--#include file="IncAsp/redsunny_log.asp"--><div class="d5"></div>
</td>
<td valign="top" class="all_c_td">
<table width="99%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="sort"> <IMG src="Skin/<%=redsunny_skin%>/home.gif" border=0 align="absmiddle"> 您的位置: <a href="index.asp">首页</a> >> 购物车</td></tr>
</table>
<%if Request.Cookies("redsunny")("user_name")="" and Request.Cookies("redsunny")("guest")="" then
response.redirect "login.asp?comurl=buy.asp"
response.end
else
if Request.Cookies("redsunny")("user_name")<>"" then
user_name=Request.Cookies("redsunny")("user_name")
elseif Request.Cookies("redsunny")("guest")<>"" then
user_name=Request.Cookies("redsunny")("guest")
end if
if request("action")="change" then '更改数量
if request("count")="" or Not(isNumeric(request("count"))) then
count=1
else
count=Cint(request("count"))
end if
basket_id=request("basket_id")
set rs=server.createobject("adodb.recordset")
sql="select hw_id,basket_count from redsunny_basket where user_name='"&user_name&"' and basket_id="&basket_id&" and basket_check=0"
rs.open sql,conn,1,3
if not rs.eof then
hw_id=rs("hw_id")
set rsh=server.createobject("adodb.recordset")
sql="select hw_kucun from redsunny_hw where hw_id="&hw_id&""
rsh.open sql,conn,1,1
hw_kucun=rsh("hw_kucun")
if count>hw_kucun then
Response.Write"<script language=javascript>alert('定购数量不能大于库存');window.location.href='"&Request.ServerVariables("Http_Referer")&"';</script>"
response.End
else
rsh.close
set rsh=nothing
rs("basket_count")=count
rs.update
end if
end if
rs.close
set rs=nothing
response.redirect "buy.asp"
response.End
elseif request("action")="del" then '删除定购
basket_id=request("basket_id")
set rs=server.createobject("adodb.recordset")
sql="select * from redsunny_basket where user_name='"&user_name&"' and basket_id="&basket_id&" and basket_check=0"
rs.open sql,conn,1,3
if rs.eof then
response.redirect "buy.asp"
response.End
else
rs.delete
rs.update
end if
rs.close
set rs=nothing
response.redirect "buy.asp"
response.End
end if
%>
<table border="0" cellpadding="0" cellspacing="0" class="useri">
<tr><td height="150">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" class="cartshowa">商品名称</td>
<td align="center" class="cartshowa">单价(<%=danwei%>)</td>
<td align="center" class="cartshowa">数量</td>
<td align="center" class="cartshowa">合计(<%=danwei%>)</td>
<td align="center" class="cartshowa">类型</td>
<td align="center" class="cartshowa" width="180">操作</td>
</tr>
<%set rs=server.createobject("adodb.recordset")
sql="select * from redsunny_basket where user_name='"&user_name&"' and basket_check=0"
rs.open sql,conn,1,1
if rs.eof then%>
<tr><td height="50" colspan="6" align="center">你没有选择任何商品</td></tr>
<%
else
i=0
do while not rs.eof
i=i+1
%>
<form name="form1" method="POST" action="buy.asp?action=change&basket_id=<%=rs("basket_id")%>"><tr>
<td align="center" class="cartshow<%=(i mod 2)%>"><a target="_blank" href="<%if rs("tao_id")>0 then%>views_tao.asp?hw_id=<%=rs("hw_id")%>&tao_id=<%=rs("tao_id")%><%else%>views.asp?hw_id=<%=rs("hw_id")%><%end if%>"><%=rs("hw_name")%></a></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=fuhao%><%=trim(rs("hw_price"))%></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><input type="text" name="count" size="2" value="<%=rs("basket_count")%>"></td>
<td align="center" class="cartshow<%=(i mod 2)%>" class="cartshow<%=(i mod 2)%>"><%=fuhao%><%=rs("basket_count")*trim(rs("hw_price"))%></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=rs("kxa")%>-<%=rs("kxb")%></td>
<td align="center" class="cartshow<%=(i mod 2)%>">
<input type="submit" value="更改数量" name="B1">
<input οnclick="javascript:window.open('buy.asp?action=del&basket_id=<%=rs("basket_id")%>','_self','')" type="button" value="取消定购"></td>
</tr></form>
<%totalcash=totalcash+(rs("basket_count")*trim(rs("hw_price")))
totalisbn=totalisbn+rs("basket_count")*rs("hw_jifen")
totalw=totalw+(rs("basket_count")*trim(rs("hw_weight")))
totaly=totaly+(rs("basket_count")*trim(rs("hw_yunfei")))
totalc=totalc+rs("basket_count")
rs.movenext
loop
end if
rs.close
set rs=nothing%></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td height="30" colspan="8" align="right">
<%if Request.Cookies("redsunny")("user_type")="" then
zhekou=100
usertype_name="未登录用户"
zhekouyu="不享受折扣价"
else
user_type=Request.Cookies("redsunny")("user_type")
set rs=server.createobject("adodb.recordset")
sql="select * from redsunny_usertype where usertype_id="&user_type&""
rs.open sql,conn,1,1
if rs.eof then
zhekou=100
usertype_name="一般用户"
zhekouyu="不享受折扣价"
else
zhekou=rs("usertype_zhekou")
usertype_name=rs("usertype_name")
zhekouyu="享受原价"&zhekou&"%的折扣价"
end if
rs.close
set rs=nothing
end if%>
<p style="line-height: 200%; margin-left:5px; margin-right:15px; margin-top:5px; margin-bottom:5px">
共 <span class="price"><%=totalc%></span> 件商品 价格总计:<span class="price"><%=fuhao%> <%=totalcash%> <%=danwei%></span> 您是:<font color="#0000FF"><%=usertype_name%></font>(<%=zhekouyu%>)<br>
折后价格:<span class="price"><%=fuhao%> <%=FormatNum(totalcash*zhekou/100)%> <%=danwei%></span> 获得积分:<%=totalisbn%><br>
<%if yunfei=2 then%>预计运费合计:<%=fuhao%> <%=totaly%> <%=danwei%><%elseif yunfei=3 then%>重量合计:<%=totalw%> kg<%end if%><br>
<%if mian<>0 then%><%if int(mian)>int(totalcash*zhekou/100) then%>还差<%=fuhao%><%=mian-int(totalcash*zhekou/100)%> <%=danwei%>即可免费送货!<%else%>满<%=fuhao%><%=mian%> <%=danwei%>免运费,您的订单可以免费送货!<%end if%><br><%end if%>
<input οnclick="javascript:window.open('index.asp','_self','')" type="button" value="继续购物">
<input οnclick="javascript:window.open('cash.asp','_self','')" type="button" value="现在结算"></td></tr>
</table>
</td></tr>
</table>
<%end if%>
</td></tr></table></div><!--#include file="IncAsp/redsunny_copy.asp"-->
购物车代码(basket.asp)
<!-- #include file="config.inc"-->
<% '用cookies记录用户选取的商品
'接受传递的参数,即用户选中商品的信息。这些参数通过URL传递,因此需要用Form的Querystring来接收。
productid=trim(request.QueryString("productid"))
productname=trim(request.QueryString("productname"))
price=trim(request.QueryString("price"))
photo=trim(request.QueryString("photo"))
if photo="" then photo="noimage.gif"
'获取当时服务器的时间和日期,作为此次交易开始的时间
moment=date() & "" & time()
'session("insert")是记录交易订单操作的变量。如果刚刚进行了一次订单操作,则该比变量值就不为空,需要首先清空购物车
if session("insert")=session.SessionID then
session("insert")=false
for each key in request.Cookies("itembuy")
response.Cookies("itembuy")(key)=""
next
end if
'将这个商品的id加入到cookie字典itembuy中
response.Cookies("itembuy")(productid)=productid
'下面显示出用户所选择的商品的一些信息
response.Write"<font style=""font:10pt;color:ff0000"">您将下面的商品加入到了您的购物车</font><br><hr color=#999933 size=1>"
response.Write"<table><tr><td rowspan=4><img src=" & photo & " border=1></td>"
response.Write"<td>商品编号:</td><td>" & productid & "</td></tr>"
response.Write"<tr><td align=right>名称:</td><td>" & productname & "</td></tr>"
response.Write"<tr><td>优惠价格:</td><td>" & price & "</td></tr>"
response.Write"<tr><td>购物时间:</td><td>" & moment & "</td></tr></table>"
response.Write"<hr color=#999933 size=1>"
session("hasitem")=session.SessionID
%>
<html>
<head><title>放入购物车</title>
<style>
<!--
td{font:10pt; color:#6600ff;}
input{background-color:#eeeeee; border-style:solid; border-color:#6666cc; border-width:1;}
--></style>
</head>
<body style="font:10pt"><form>
<input type="button" name="close" value="继续购物" />
</form></body></html>
<script language="vbscript">
<!--
sub close_onclick()
window.close '关闭购物车,继续其他活动
end sub
-->
搜索页面代码(search.asp)
<!--#include file="conn.asp"-->
<!--#include file="IncAsp/redsunny_top.asp"-->
<div align="center">
<table cellpadding="0" cellspacing="0" class="all_t1">
<tr><td class="all_l_td" valign="top">
<!--#include file="IncAsp/redsunny_log.asp"--><div class="d5"></div><!--#include file="IncAsp/redsunny_sort.asp"--><div class="d5"></div>
</td>
<td valign="top" class="all_c_td">
<table width="99%" border="0" cellpadding="0" cellspacing="0">
<%
if request("action")="search" then
order=request("order")
page=request("page")
orderx=getorder(order)
page=getpage(page)
sert=sert&"&order="&order
hw_name=request("hw_name")
if hw_name<>"" then
set rs=server.createobject("adodb.recordset")
sql="select * from redsunny_search where search_name='"&hw_name&"'"
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("search_name")=hw_name
rs("hits")=1
else
rs("hits")=rs("hits")+1
end if
rs.update
rs.close
set rs=nothing
hwn=split(hw_name," ")
for i=0 to ubound(hwn)
hwna=trim(hwn(i))
if hwna<>" " and hwna<>"" then
sera=sera&" and hw_name like '%"&hwna&"%'"
end if
next
sert=sert&"&hw_name="&hw_name
end if
price1=DelStr(request("price1"))
if price1="" or not(isnumeric(price1)) then price1=0
price2=DelStr(request("price2"))
if price2="" or not(isnumeric(price2)) then price2=1000000000
sert=sert&"&price1="&price1
sert=sert&"&price2="&price2
if request("pagec")="" or Not(isNumeric(request("pagec"))) then
pagec=25
else
pagec=DelStr(request("pagec"))
end if
sert=sert&"&pagec="&pagec
sort_id=Request("sort_id")
if sort_id<>"" and sort_id<>0 then
chkid(sort_id)
sera=sera&" and sort_id=" & sort_id & ""
sert=sert&"&sort_id="&sort_id
end if
pinpai=request("pinpai")
if pinpai<>"" and pinpai<>0 then
chkid(pinpai)
sera=sera&" and pinpai_id=" & pinpai & ""
sert=sert&"&pinpai="&pinpai
end if
set rs=server.createobject("adodb.recordset")
sql="select hw_id,hw_name,hw_price1,hw_price2,hw_pic,hw_content from redsunny_hw where hw_price2>="&price1&" and hw_price2<="&price2&" " &sera&" order by "&orderx&""
rs.open sql,conn,1,1
if rs.eof then%><tr><td align="center" height="30">你所选的类别没有商品</td></tr><%else
rs.pagesize=pagec
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
rs.cachesize=rs.pagesize%>
<tr><td class="sort"> <IMG src="Skin/<%=redsunny_skin%>/home.gif" border=0 align="absmiddle"> 您的位置:
<a href="index.asp">首页</a> >> 商品查询 (共<%=totalrec%>件商品,
这是第<%=(page-1)*rs.pagesize+1%>-<%ifpage+1<=totalpagethen%>
<%=page*rs.pagesize%><%else%><%=totalrec%><%end if%>件)
</td></tr>
<tr><td height=5></td></tr>
<tr><td width="100%" align="center" style="border: 1px solid #E1E1E1">
<!--#include file="IncAsp/redsunny_ins.asp"-->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form action="<%=filename%>?action=search<%=sert%>" method=post>
<tr><td height="2"></td></tr>
<tr><td height="23" class="sortb">
<p style="line-height: 150%; margin: 5px">第<%=page%>页/共<%=totalpage%>页
<%if page-1>0 then%><a href="search.asp?action=search&page=<%=page-1%><%=sert%>">上一页</a><%else%>上一页<%end if%>
<%if page+1<=totalpage then%><a href="search.asp?action=search&page=
<%=page+1%><%=sert%>">下一页</a><%else%>下一页<%end if%>
页面跳转:<input type="text" name="page" value="<%=page+1%>" size="1" style="text-align: center" class=input><input type="submit" value="GO" class=input><br>
选择页数:<%for i=1 to totalpage
if i=page then%>
<font color="#FF0000"><b><%=i%></b></font>
<%else%>
<a href="search.asp?action=search&page=<%=i%><%=sert%>"><%=i%></a>
<%end if
next%></td></tr></form></table>
</td></tr>
<%end if%><%
rs.close
set rs=nothing
end if%></table>
<table width="581" border="0" cellpadding="0" cellspacing="0"><form method="POST" action="search.asp?action=search">
<tr><td height="41"><img border="0" src="img/s-0.gif" width="581" height="41"></td></tr>
<tr><td background="img/s-1.gif" align="center">
<table border="0" cellpadding="5" cellspacing="0" width="90%">
<tr><td align="right" width="100">关键字:</td>
<td width="200"><input type="text" name="hw_name" size="20" class=input value="<%=request("hw_name")%>"></td>
</tr>
<tr><td align="right" width="100">选择分类:</td><td width="423"><%set rs=server.createobject("adodb.recordset")
rs.open "select sort_id,sort_name from redsunny_sort order by sort_id DESC",conn,1,1%>
<select name="sort_id"><option value="0">查询所有分类</option>
<%do while not rs.eof%>
<option value="<%=rs("sort_id")%>"<%if int(request("sort_id"))=rs("sort_id") then%> selected<%end if%>><%=rs("sort_name")%></option>
<%rs.movenext
loop
rs.close
set rs=nothing%></select></td></tr>
<tr><td align="right" width="100">选择品牌:</td>
<td width="423"><select name="pinpai">
<option value="0">查询所有品牌</option>
<%set rs=server.createobject("adodb.recordset")
rs.open "select pinpai_id,pinpai_name from redsunny_pinpai order by pinpai_id DESC",conn,1,1%><%do while not rs.eof%>
<option value="<%=rs("pinpai_id")%>"<%if int(request("pinpai"))=rs("pinpai_id") then%> selected<%end if%>><%=rs("pinpai_name")%></option>
<%rs.movenext
loop
rs.close
set rs=nothing%></select></td></tr>
<tr><td align="right" width="100">价格范围:</td><td width="423">
<input type="text" name="price1" size="3" class=input value="<%=request("price1")%>"> -
<input type="text" name="price2" size="3" class=input value="<%=request("price2")%>"></td></tr>
<tr><td colspan="2" width="100%">热门搜索:<%call getsearch(10,10,"")%></td></tr></table></td></tr>
<tr><td height="86"><img border="0" src="img/s-2.gif" width="581" height="86"></td></tr>
<tr><td align="center" background="img/s-1.gif"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td height="30" width="100" align="right">排列方式:</td><td height="30" width="423"><select size="1" name="order">
<option selected value="">默认</option>
<option value="price1">价格由低到高</option>
<option value="price2">价格由高到低</option>
<option value="time">添加时间</option></select></td></tr>
<tr><td height="30" width="100" align="right">每页数量:</td><td height="30" width="423"><select size="1" name="pagec">
<option>10</option>
<option selected>25</option>
<option>50</option>
<option>100</option></select></td></tr>
<tr><td width="100" height="30"></td><td height="30" width="423"><input type="submit" value="提交查询" style="height:23;width:107"></td></tr>
</table></td></tr>
<tr><tdheight="17"><imgborder="0"src="img/s-3.gif"width="581"height="17"></td></tr></form>
</table></td></tr></table></div><!--#include file="IncAsp/redsunny_copy.asp"-->
评论页面代码(comment.asp)
<!--#include file="conn.asp"-->
<%
hw_id=request("id")
chkid(hw_id)
set rs2=server.createobject("adodb.recordset")
if commentshow=1 then
sql="select top 10 * from redsunny_comment where dateid="&hw_id&" order by id desc"
else
sql="select top 10 * from redsunny_comment where dateid="&hw_id&" and c_c=1 order by id desc"
end if
rs2.open sql,conn,1,1
do while not rs2.eof%>
document.write('<table border="0" cellpadding="3" cellspacing="0" width="99%">');
document.write('<tr><tdwidth="50"align="right"><IMGsrc="Skin/<%=redsunny_skin%>
/dot3.gif" border=0 align="absmiddle"></td>');
document.write('<td width="200"><b><%=rs2("title")%></b></td>');
document.write('<tdclass="anse">(评论者:<%=rs2("Mail")%>
<%=rs2("date")%>)</td></tr>');
document.write('<tr><td></td><td colspan="2"><font color="#4D8B9E">内容:<%=replace(rs2("Comment"),vbcrlf," ")%></font></td></tr>');
<%if rs2("c_c")=1 then%>document.write('<tr><td></td><td colspan="2"><font color="#800000">回复: <%=rs2("adminfu")%></font></td></tr>');<%end if%>
document.write('<tr><td colspan="3" height="2" background="Img/dot_menu.gif"></td>
</tr></table>');
<%rs2.movenext
loop
rs2.close
set rs2=nothing%>
七、附图
首页截图
分类页面截图
产品详细页截图
注册页面截图
搜索页面截图
八、结束语
经过几个月的努力,终于将网站设计完成,颇有大功告成的意味!这短短的几个月,让我真的感觉到:未来的路很长,我需要加倍努力!
从开始的架构规划到最后的编程,以及界面的设计,一系列实践中我学到了很多很多。人就是在不断的学习中不断长大,这是我在这次毕业设计结束后得到的最大体会!
一个购物网站,并不是那么简单的增加几个购物按钮,把ASP语言编写好,把数据库建好就没有事情做了。真正的购物系统,如亚马逊、当当等,在其中都加入了用户体验的!尤其是亚马逊购物网站,无论是导航,搜索还是界面或者是其他,都可以看到用户体验的影子!这其中不得不提到一个系统架构(IA),系统架构是基础中的基础!试想下如果一个购物网站不能满足同时500人访问,那么这个网站还有存在的价值么?我估计不是很大!
路漫漫其修远兮,吾辈上下而求索!学以致用,并不断提高自己,我相信,终有天,会站在世界的巅峰!
九、参考资料
Dreamweaver 8完美网页设计——ASP动态网页设计篇 中国电力出版社
ASP开发技术大全 人民邮电出版社
Access数据库开发经典案例解析 清华大学出版社
精通CSS:高级Web标准解决方案 人民邮电出版社
无懈可击的Web设计 清华大学出版社