資源描述:
《asp調(diào)用模板生成html----asp文件(更新代碼)(the asp call template generates the html----asp file (updated code))》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、asp調(diào)用模板生成html----asp文件(更新代碼)(TheASPcalltemplategeneratesthehtml----aspfile(updatedcode))TheASPcalltemplategeneratesthehtml----aspfile(updatedcode)Thursday,December31,2009,05:30p.m."--#includefile="CONN.ASP"-->!<
2、Ifrequest("style")="Make"Then'determinewhethertogenerateHTML'----------------------------------------------------'openfileprocedurefunction'FunctionOpenfile(URL)Dim,fileurl,mfile,content,FSOFileurl=Server.MapPath(URL)SetFso=Server.CreateObject('Scripting.Filesystemobje
3、ct')'definesFSO"Setmfile=Fso.OpenTextFile(fileurl,1)"opensthefileinreadmodeIfNotmfile.AtEndOfStreamThenContent=mfile.ReadAll()readallofthecontentEndIfMfile.CloseOpenFile=contentEndFunction'----------------------------------------------------ThelegendaryRS...Noexplanati
4、onSetrs=Server.CreateObject("ADODB.RecordSet")SQL="select*,from,Table_News,order,sys_id,DESC,by".Thisisthenameofthenameinmydatabase.PleasechangeitbyyourselfRs.Open,SQL,Conn,1,1'----------------------------------------------------"Tomakeajudgment,thisexampleisonlytoachi
5、eveeffect,pleaseincreaseyourownsecuritydetectionRsnum=rs.recordcount'toreadallthedatainthedatabasejusttobeabletodisplaynormallyPage=CInt(request.Form('page'))'takesthenumberofpagesintheformtogenerateFolder=Trim(request.Form("folder")).Createfolderoptionsintheform.Notet
6、hatthereisnodetectionhere.It'sasecurityhazard'----------------------------------------------------'userinputundersimplejudgmentIfIsNumeric(page)=falseThen"Response.Writepage&""nonnumeric".Pleasere-enter!"Response.End()ElseIfPage>rsnumThenPage=rsnumEndIfEndIfIfpage="The
7、n"Page=rsnumEndIf'----------------------------------------------------'simplyjudgewhethertousethedefaultfolderIfFolder="Then"Folder="news""EndIf'----------------------------------------------------ForI=1,To,page'startprocessingvariableshereandgetresults'---------------
8、-------------------------------------"Idon'texplainthefollowingassignmentvariables,dothey?"Keyword=RS("News_Keyword")