% dim action : action=getForm("action","get") dim advname,advclass,ImagePath,LinkPath,imgw,imgh,stime,etime,AdvStatus,advcontent,LanguageID,AddTime,orderStr,whereStr,sqlStr,rsObj,allPage,allRecordset,numPerPage,page, psize, order, ordsc,sortID,keyword,sortType,AdvArray,LinkPathr,ImagePathr,fLinkPath,fImagePath,fLinkPathr,fImagePathr,fAdvID,fAdvName,fAdvClass,fimgw,fimgh,fstime,fetime,fAdvStatus,fadvcontent,fAdvStyle,AdvStyle,faore advname=getForm("advname","post") advclass=getForm("advclass","post") ImagePath=getForm("ImagePath","post") LinkPath=getform("LinkPath","post") ImagePathr=getForm("ImagePathr","post") LinkPathr=getform("LinkPathr","post") imgw=getForm("imgw","post") imgh=getForm("imgh","post") stime=getForm("stime","post") etime=getForm("etime","post") AdvStatus=getForm("AdvStatus","post") advcontent=getForm("advcontent","post") advstyle=getForm("advstyle","post") sortType=getForm("sortType","get") if isnul(sortType) then sortType=0 sortid=getForm("sortid","post") if isnul(sortid) then sortid=getForm("sortid","get") keyword=getForm("keyword","post") if isnul(keyword) then keyword=getForm("keyword","get") page=getForm("page","get") psize=getForm("psize","get") order=getForm("order","get") ordsc=getForm("ordsc","get") faore=getForm("faore","get") Select case action case "add" : advadd case "del" : AdvDel case "edit" : editform case "editsave": editsave case "editjs" if faore=0 then call advadd else call editsave end if case "savejs":savejs case "on" : onOff "on", "Adv", "AdvId", "AdvStatus", "", getPageName()&"?sortType="&sortType&"&sortid="&sortid&"&keyword="&keyword&"&page="&page&"&psize="&psize&"&order="&order&"&ordsc="&ordsc case "off" : onOff "off", "Adv", "AdvId", "AdvStatus", "", getPageName()&"?sortType="&sortType&"&sortid="&sortid&"&keyword="&keyword&"&page="&page&"&psize="&psize&"&order="&order&"&ordsc="&ordsc End Select Sub editsave dim whereStr dim AdvID : AdvID=getForm("id","both") whereStr="where AdvID="& AdvID if isnul(advname) then alertMsgAndGo"請填寫廣告名稱","-1" if not ISDATE(stime) then alertMsgAndGo"時間格式錯誤","-1" if not ISDATE(etime) then alertMsgAndGo"時間格式錯誤","-1" if datediff("s",stime,etime)<0 then alertMsgAndGo"開始時間不能大於結束時間","-1" select case advclass case 5 ImagePath=ImagePath&"$img$"&ImagePathr LinkPath=LinkPath&"$link$"& LinkPathr end select if advstyle="" then advstyle=1 conn.exec "update {prefix}Adv set AdvName='"&advname&"', AdvClass="&advclass&", AdvImg='"&ImagePath&"', AdvLink='"&LinkPath&"', AdvWidth='"&imgw&"', AdvHeight='"&imgh&"', AdvStime='"&stime&"', AdvEtime='"&etime&"', AdvStatus="&AdvStatus&", AdvContent= '"&advcontent&"',AdvStyle="&advstyle&" "& whereStr &"","exe" if advclass=4 then alertMsgAndGo"保存成功", "AspCms_AdvEditPF.asp?action=savejs&id=4" elseif advclass=5 then alertMsgAndGo"保存成功", "AspCms_AdvEditDl.asp?action=savejs&id=5" elseif advclass=6 then alertMsgAndGo"保存成功", "AspCms_AdvEditTC.asp?action=savejs&id=6" else alertMsgAndGo"保存成功", "AspCms_Advlist.asp" end if End Sub Sub savejs dim whereStr,arrl,arri dim ClassID : ClassID=getForm("id","both") whereStr="where AdvClass="& ClassID AdvArray=conn.Exec("select AdvID,AdvName,AdvClass,AdvImg,AdvLink,AdvWidth,AdvHeight,AdvStime,AdvEtime,AdvStatus,AdvContent,AdvStyle from {prefix}Adv "&whereStr&"","arr") if not isarray(AdvArray) then faore=0 fImagePath="" fLinkPath="" fImagePathr="" fLinkPathr="" fAdvID="" fAdvName="" fAdvClass="" fimgw="" fimgh="" fstime=now() fetime=now() fAdvStatus=1 fAdvContent="" fAdvStyle=1 else faore=1 fAdvID=AdvArray(0,0) fAdvName=AdvArray(1,0) fAdvClass=AdvArray(2,0) fimgw=AdvArray(5,0) fimgh=AdvArray(6,0) fstime=AdvArray(7,0) fetime=AdvArray(8,0) fAdvStatus=AdvArray(9,0) fAdvContent=AdvArray(10,0) fAdvStyle=AdvArray(11,0) if AdvArray(2,0)=5 then arri=split(AdvArray(3,0),"$img$") arrl=split(AdvArray(4,0),"$link$") fImagePath=arri(0) fLinkPath=arrl(0) fImagePathr=arri(1) fLinkPathr=arrl(1) else fImagePath=AdvArray(3,0) fLinkPath=AdvArray(4,0) fImagePathr="" fLinkPathr="" end if end if End Sub Sub editform dim whereStr,arrl,arri dim AdvID : AdvID=getForm("id","both") whereStr="where AdvID="& AdvID AdvArray=conn.Exec("select AdvID,AdvName,AdvClass,AdvImg,AdvLink,AdvWidth,AdvHeight,AdvStime,AdvEtime,AdvStatus,AdvContent from {prefix}Adv "&whereStr&"","arr") if not isarray(AdvArray) then alertMsgAndGo "未存在的廣告!","-1" if AdvArray(2,0)=5 then arri=split(AdvArray(3,0),"$img$") arrl=split(AdvArray(4,0),"$link$") fImagePath=arri(0) fLinkPath=arrl(0) fImagePathr=arri(1) fLinkPathr=arrl(1) else fImagePath=AdvArray(3,0) fLinkPath=AdvArray(4,0) fImagePathr="" fLinkPathr="" end if End Sub Sub advadd 'LanguageID=cint(rCookie("languageID")) 'if not isnum(LanguageID) then alertMsgAndGo"當前操作語言錯誤,請重新登陸","-1" if isnul(advname) then alertMsgAndGo"請填寫廣告名稱","-1" if not ISDATE(AddTime) then AddTime=now() if not ISDATE(stime) then alertMsgAndGo"時間格式錯誤","-1" if not ISDATE(etime) then alertMsgAndGo"時間格式錯誤","-1" if datediff("s",stime,etime)<0 then alertMsgAndGo"開始時間不能大於結束時間","-1" select case advclass case 5 ImagePath=ImagePath&"$img$"&ImagePathr LinkPath=LinkPath&"$link$"& LinkPathr end select if advstyle="" then advstyle=1 conn.exec "insert into {prefix}Adv(AdvName, AdvClass, AdvImg, AdvLink, AdvWidth, AdvHeight, AdvStime, AdvEtime, AdvStatus, AdvContent, AddTime,AdvStyle) values('"&advname&"', "&advclass&", '"&ImagePath&"', '"&LinkPath&"', '"&imgw&"', '"&imgh&"', '"&stime&"', '"&etime&"', "&AdvStatus&", '"&advcontent&"', '"&AddTime&"',"&advstyle&")","exe" if advclass=4 then alertMsgAndGo"保存成功", "AspCms_AdvEditPF.asp?action=savejs&id=4" elseif advclass=5 then alertMsgAndGo"保存成功", "AspCms_AdvEditDl.asp?action=savejs&id=5" elseif advclass=6 then alertMsgAndGo"保存成功", "AspCms_AdvEditTC.asp?action=savejs&id=6" else alertMsgAndGo"保存成功", "AspCms_Advlist.asp" end if End Sub Sub AdvList dim i numPerPage=psize if not isnum(numPerPage) then numPerPage=10 if isnul(order) then order="AdvID" if isnul(ordsc) then ordsc="desc" if isNul(page) then page=1 else page=clng(page) if page=0 then page=1 orderStr=" order by "&order&" "&ordsc 'whereStr=" where LanguageID="&rCookie("languageID") whereStr=" where AdvClass not in(4,5,6)" sqlStr = "select AdvID,AdvName,AdvClass,AdvStime,AdvEtime,AdvStatus from {prefix}Adv"&whereStr & orderStr set rsObj = conn.Exec(sqlStr,"r1") rsObj.pagesize = numPerPage allRecordset = rsObj.recordcount : allPage= rsObj.pagecount if page>allPage then page=allPage if allRecordset=0 then if not isNul(keyword) then echo "