【正文】
擊了確認(rèn)修改密碼的按鈕 if NOT isempty(request(ChangePwsSubmit)) then dim username 39。初始化 recordset對象 set rs=() 39。 amp。39。用 MD5加密密碼后和原密碼對比驗(yàn)證 if md5(trim(request(password)))trim(rs(password)) then call MsgBox(對不起,您輸入的原密碼錯誤! ,Back,None) else rs(password)=md5(trim(request(password1))) set rs=nothing call MsgBox(密碼更改成功! ,none,none) end if end if % 3. 2 圖書信息模塊的實(shí)現(xiàn) 主要是查看圖書列表、搜索圖書、顯示圖書信息、把圖書放入購物車等功能。 :顯示分類圖書。 :顯示暢銷圖書。 :搜索圖書,可以按照圖書名稱、作者名稱、 出版社、出版時間、價格范圍及圖書類別搜索。 :查看詳細(xì)圖書信息。 圖書詳細(xì)信息顯示 程序完成當(dāng)用戶單擊圖書名稱時顯示圖書的詳細(xì)信息。得到圖書 id id=(id) 39。初始化 recordset對象 set rs=() 39。id,conn,1,3 39。例如 ,我現(xiàn)在要搜索一本書名中有 ASP的圖書 ,就可 以這樣做 ,如圖 34。 圖 34 圖書搜索 圖 35 圖書搜索結(jié)果 : !include file=manage/inc/ !include file=inc/ % 39。開始分頁 Const MaxPerPage=5 dim totalPut dim CurrentPage dim TotalPages dim j dim sql dim nid,sortsid if Not isempty((page)) then currentPage=Cint((page)) else currentPage=1 end if set rs=() 39。把從 name=trim((name)) author=trim((author)) manufacturer=trim((manufacturer)) enabledate=trim((enabledate)) expiredate=trim((expiredate)) smallprice=trim((smallprice)) largeprice=trim((largeprice)) OrderField=trim((OrderField)) Order=trim((Order)) code=trim((code)) if OrderField= then OrderField=adddate if Order= then Order=DESC sql=select pagenum,name,mark,vipprice,id,author,productdate,price2,price1,discount,pic from product where 1=1 39。and name like 39。nameamp。 end if if author then sql=sqlamp。%amp。%39。and mark like 39。manufactureramp。 end if if code then sql=sqlamp。%amp。%39。and price2 = amp。and price2 = amp。and productdate = amp。 end if if enabledate then enabledate=CDate(enabledate) sql=sqlamp。enabledateamp。 order by amp。 amp。查詢數(shù)據(jù)庫 sql,conn,1,1 39。搜索數(shù)量 totalPut= 39。尾頁判斷 if (currentpage1)*MaxPerPagetotalput then if (totalPut mod MaxPerPage)=0 then currentpage= totalPut \ MaxPerPage else currentpage= totalPut \ MaxPerPage + 1 end if end if 39。客戶可隨時通過 車?yán)飯D書的詳細(xì)信息,如果不滿意可通過刪除功能刪除圖書。判斷客戶動作,是否單擊 “ 購物車 ” dim iaction,iid iaction=(action) iid=(id) 39。初始化 recordset對象 set rs=() 39。amp。39。iidamp。添加到購物車 rs(id)=iid rs(username)=trim((cookieName)(username)) rs(state)=6 rs(paid)=0 call MsgBox( 商品成功添加到你的購物籃 !,None,None) end if set rs=nothing end if end if 39。查詢數(shù)據(jù)庫 , 根據(jù)用戶級別查詢相應(yīng)價格 select count(*) as co,sum() as vipsum,sum(product. price2) as psum from product inner join orders on = where orders. username =39。request. cookies(cookieName)(username)amp。 and =6, conn,1,1 39。普通用戶 else iPrice=ICarRs(psum) end if pNum=iCarRs(co) if pNum=0 then iPrice=0 39。amp。39。其代碼如下: !include file=manage/inc/ !include file=inc/ !include file=inc/ % dim id,username,action 39。初始化 recordset對象 set rs=() select case action 39。request. QueryStringctionid) 39。amp。 39。idamp。如果購物車?yán)餂]有該圖書 else select id,username,state,paid from orders,conn,1,3 rs(id)=id rs(username)=username rs(state)=6 rs(paid)=0 set rs=nothing call MsgBox(商品成功添加到你的購物籃! ,Close,None) end if end select select ,product. price1,product. rice2, from product inner join orders on = where =39。 (cookieName)(username)amp。 and =6,conn,1,1 % 3. 3 系統(tǒng)管理模塊的實(shí)現(xiàn) manage/:管理員登錄程序。 manage/:管理員用戶管理程序,包括添加、刪除、修改權(quán)限。 manage/:圖書的添加程序。這里主要介紹圖書的添加功能的實(shí)現(xiàn) 和客戶管理及管理員的管理。其運(yùn)行界面如圖 37 圖 38 圖書添加界面 其關(guān)鍵代碼如下: !include file=inc/ !include file=inc/ !include file=inc/ % 39。判斷是否進(jìn)行添加產(chǎn)品操作 If NOT IsEmpty (request(AddProSubmit)) then dim productdate,discount discount=round(request(price2)/request(price1),2) 39。 年amp。月 else productdate= end if 39。開 始添加 rs(productdate)=productdate rs(discount)=discount 39。是否推薦產(chǎn)品 if request(remend)=1 then rs(remend)=1 else rs(remend)=0 end if set rs=nothing call MsgBox(添加成功! ,GoUrl,) end if % 3. 3. 2 客戶和管理員用戶的管理 ,在此頁面上管理員可對客戶進(jìn)行管理,單擊某 一用戶名,還可對該客戶的詳細(xì)信息進(jìn)行修改,但不能修改用戶名。判斷管理員級別 if session(rank)1 then call Msgbox(你的權(quán)限不夠! ,Back,None) end if % % 判斷管理員是否單擊了刪除用戶按鈕 if NOT isempty(request(DelQuserSubmit)) then dim userid 39。執(zhí)行刪除語句,刪除選定客戶 delete from [user] where userid in (amp。) delete from orders where userid in (amp。) end if % manage/、刪除及修改管理權(quán)限等操作。其運(yùn)行界面如圖 310 圖 310 管理員管理頁面 其代碼如下: !include file=inc/ !include file=inc/ !include file=inc/ % 39。如果提交表單就建立 Recoredset對像 If NOT IsEmpty () then set rs=() 39。添加后臺用戶 If NOT IsEmpty (Request(AddHuser)) then select * from admin,conn,1,3 rs(admin)=trim(request(AddName)) rs(password)=md5(trim(request(AddPws))) rs(rank)=int(request(AddRank)) set rs=nothing call MsgBox(添加成功! ,GoUrl,) end If 39。取得 Id號 (delete from admin where id=amp。修改后臺用戶資料 if NOT IsEmpty (request(Modify)) then 39。id,conn,1,3 rs(admin)=trim(request(Name)) if trim(request(password)) then rs(password)=md5(trim(request(password))) end if rs(rank)=int(request(rank)) set rs=nothing call MsgBox(修改成功! ,GoUrl,) end if % 第四章 網(wǎng)站的建立與運(yùn)行環(huán)境 網(wǎng)站的建立與測試 在實(shí)現(xiàn)了整個網(wǎng)上書店的系統(tǒng)功能之后,需要建立一個網(wǎng)站對其進(jìn)行測試。本系統(tǒng)使用 IIS。 ③ 設(shè) 置 啟 動 默 認(rèn) 文 檔 為 。因此,配置這些網(wǎng)站時需要滿足以下系統(tǒng)配置要求。 網(wǎng)上購物是當(dāng)今 Web應(yīng)用的潮流,許多站點(diǎn)上都可以見到關(guān)于此方面的嘗試。 致 謝 首先,我要深深的感謝我的指導(dǎo)老師某某 老師。 在我論文研究的立題、設(shè)計等諸方面給予了極大的幫助,使我的畢業(yè)課題和論文在理論和實(shí)踐上得到了極大地豐富和提高。在此,我向您們表示衷心的感謝! 感謝我大學(xué)時代的所有同學(xué),難忘一起走過、相互關(guān)心、鼓勵、支持和幫助的日子。在此,祝福他們擁有更加美好的明天! 最后感謝我的父親、母親和所有關(guān)心支持我的人,正是他們給予了我?guī)椭完P(guān)懷,讓我學(xué)會了如何做人。 [11] Personalized Dis