%@ Language="VBScript" %> <% If ((Len(Trim(session("userid"))) = 0) or (Len(Trim(session("passwd"))) = 0)) Then response.Redirect "http://localhost/cdc/admin/admin_main.asp" End If %> <% dim rpath rpath = "e:/project/cdc/data/speeches/" & session("fname") & ".html" tpath = "e:/project/cdc/data/speeches/" & session("fname") & ".txt" session("fpath") = rpath Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject") Set MyTextFile=MyFileObject.OpenTextFile(rpath,2,True,-2) Set objTextSourceFile = MyFileObject.OpenTextFile("e:\project\cdc\datafiles\temp\template.html") Do While Not objTextSourceFile.AtEndOfStream temp = objTextSourceFile.ReadLine if temp <> "bodyhere" then MyTextFile.WriteLine temp else MyTextFile.WriteLine "
" MyTextFile.WriteLine formatdatetime(session("new_pub_date"),vbLongDate) & "" MyTextFile.WriteLine "" & session("title") & "
" MyTextFile.WriteLine session("htmlcontent") & "
" end if Loop objTextSourceFile.Close set objTextSourceFile = Nothing MyTextFile.Close set MyTextFile = Nothing Set MyFile=MyFileObject.OpenTextFile(tpath,2,True,-2) MyFile.WriteLine session("pub_date") MyFile.WriteLine session("title") MyFile.WriteLine session("txtcontent") MyFile.Close set MyFile = Nothing 'Response.Redirect("cont_add.asp") %> <% dim objfso, objtxtfile dim pub_date dim fileext dim filecontent dim oldentry dim newentry Set objfso = CreateObject("Scripting.FileSystemObject") Set objtxtfile = objfso.OpenTextFile("e:\project\cdc\datafiles\speeches.txt",1,true,0) filecontent=objtxtfile.readall objtxtfile.close oldentry=session("fname") & "," & Session("title") & "," & session("pub_date") newentry=session("fname") & "," & Session("new_title") & "," & session("new_pub_date") filecontent=replace(filecontent,oldentry,newentry) Set objtxtfile = objfso.OpenTextFile("e:\project\cdc\datafiles\speeches.txt",2,true,0) objtxtfile.write filecontent objtxtfile.close fileext = session("fname") & ".html" %>
|