资源描述:
《asp调用模板生成html----asp文件(更新代码)(the asp call template generates the html----asp file (updated code))》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、asp调用模板生成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")