<!--#include file="conn.asp"--> <% newstitle=trim(request("newstitle")) '接受文章标题 origin=trim(request("origin")) '接受文章来源 author=trim(request("author")) '接受文章作者 vcontent=trim(request("content")) '接受文章内容
response.write newstitle&origin&author&vcontent 'vcontent=replace(vcontent,"<","<") 'vcontent=replace(vcontent,">",">") 'vcontent=replace(vcontent,"'","<|>") 'vcontent=replace(vcontent,vbCrLf,"<br>") 'vcontent=replace(vcontent," "," ") '生成文件夹名 thetime=now theyear=year(thetime) themon=month(thetime) theday=day(thetime) thehor=hour(thetime) themin=minute(thetime) thesec=second(thetime)
if themon<10 then themon="0"&themon end if if theday<10 then theday="0"&theday end if if thehor<10 then thehor="0"&thehor end if if themin<10 then themin="0"&themin end if if thesec<10 then thesec="0"&thesec end if
wenjian=theyear&themon&theday&thehor&themin&thesec newsurl=""&wenjian&"/index.htm"
'写数据库 sqlstr="insert into newsinfo(newstitle,origin,author,vcontent,addtime,newsurl) values ('"&newstitle&"','"&origin&"','"&author&"','"&vcontent&"','"&thetime&"','"&wenjian&"')" conn.execute sqlstr
'取模板生成文件 set rs2 = server.CreateObject("ADODB.RecordSet") StrSql = "select mbnr from moban where mbid=1" set rs2 = conn.Execute (StrSql)
pencat=rs2("mbnr") pencat=replace(pencat,"{newstitle}",newstitle) pencat=replace(pencat,"{addtime}",thetime) pencat=replace(pencat,"{origin}",origin) pencat=replace(pencat,"{author}",author) pencat=replace(pencat,"{vcontent}",vcontent) pencat=replace(pencat,"{about}",wenjian)
Set fso = Server.CreateObject("Scripting.FileSystemObject") '创建文件夹 fso.CreateFolder Server.MapPath("../" & wenjian) Set fout = fso.CreateTextFile(server.mappath("../"&newsurl)) fout.WriteLine pencat fout.close
conn.close response.redirect "addit.asp" %> |