<!--#include file="conn.asp" -->
<!--#include file=cookies.asp-->
<!--#include file="../inc/jle_sub.asp"-->
<%
function fsow(filename)
set mfo=Server.CreateObject("Scripting.FileSystemObject")
set rtf=mfo.OpenTextFile(server.mappath(filename),1)
body=rtf.readall
fsow=body
end function
dim CM
CM=request("Type")
%>

<%'以下为批量生成程序
set ru=Server.CreateObject("ADODB.Recordset")
if CM= "all" then
sql="Select * from jle_info where id >= "&request("B_ID")&" and id <= "&request("E_ID")&" order by id desc"
end if
if CM= "one" then
sql="Select * from jle_info where class1= "&request("class")&"  order by id desc"
end if
ru.open sql,conn,3,3
do while not ru.bof and not ru.eof %>
<%
okfile=fsow("../inc/categories_mb.html")
dim NewsFile
if right(ru("xurl"),4)="html" then
ax=left(ru("xurl"),10)
file1=server.mappath("../"&ax&"")
NewsFile2 = ru("xurl")
NewsFile=replace(NewsFile2,""&ax&"/","")
else
file1=server.mappath("../jhinfo")
'NewsFile=month(now)&day(now)&hour(now)&minute(now)&second(now)&""&ru("id")&".html"
'NewsFile = ru("id")&".html"
NewsFile = year(now)&month(now)&day(now)&""&ru("id")&".html"
NewsFile2="jhinfo/"&NewsFile
end if

file2=file1&"\"&NewsFile
x_id = ru("id")
diqu = ru("diqu")
leixing=ru("leixing")
class1=ru("class1")
class2=ru("class2")
biaoti=ru("biaoti")
memo=ru("memo")
tupian=ru("tupian")
name=ru("name")
dianhua=ru("dianhua")
qq=ru("qq")
dizhi=ru("dizhi")
userip=ru("ip")
email=ru("email")

set rc=Server.createObject("adodb.recordset")
sql="select * from class1 where id ="&class1&""
rc.open sql,conn,1,1
dim cla1
cla1=rc("class1")
rc.close
set rc=nothing
set rc=Server.createObject("adodb.recordset")
sql="select * from class2 where id ="&class2&" "
rc.open sql,conn,1,1
if  rc.eof and rc.bof then
cla2="没有该类"
else
dim cla2
cla2=rc("class2")
end if
rc.close
set rc=nothing
if vartype(ru("fbsj")) = 1 then
fbsj = now()
else
fbsj = ru("fbsj")
end if

okfile = replace(okfile,"X_ID",x_id)
okfile = replace(okfile,"City",city)
okfile = replace(okfile,"Class1",cla1)
okfile = replace(okfile,"C1url",class1)
okfile = replace(okfile,"Class2",cla2)
okfile = replace(okfile,"C2url",class2)
okfile = replace(okfile,"Diqu",diqu)
okfile = replace(okfile,"Leixing",leixing)
okfile = replace(okfile,"Biaoti",biaoti)
okfile = replace(okfile,"Memo",memo)
okfile = replace(okfile,"Adclass1",adclass1)
if tupian<>"" and tupian<>"0" then
if left(tupian,4)="http" then
okfile = replace(okfile,"Tupian",""&tupian&"")
okfile = replace(okfile,"TUurl",""&tupian&"")
else
okfile = replace(okfile,"Tupian","/"&tupian&"")
okfile = replace(okfile,"TUurl","/"&tupian&"")
end if
else
okfile = replace(okfile,"Tupian",ad11(0))
okfile = replace(okfile,"TUurl",ad11(1))
end if
okfile = replace(okfile,"Fbsj",fbsj)
if name<>"" and dianhua<>"" and userip<>"" then
okfile = replace(okfile,"Name",name)
okfile = replace(okfile,"Dianhua",dianhua)
okfile = replace(okfile,"Userip",userip)
end if
if qq<>"" then
okfile = replace(okfile,"Qq",qq)
else 
okfile  =  replace(okfile,"Qq","这家伙很懒，没留下QQ。")
end if
if dizhi<>"" then
okfile = replace(okfile,"Dizhi",dizhi)
else 
okfile = replace(okfile,"Dizhi","这家伙很懒，没留下联系地址。")
end if
if email<>"" then
okfile = replace(okfile,"Email",email)
else 
okfile  =  replace(okfile,"Email","这家伙很懒，没留下邮箱。")
end if
okfile = replace(okfile,"Title",title)
okfile = replace(okfile,"Web",web)
okfile = replace(okfile,"Coryright",coryright)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(file2,true)
fout.writeline okfile
fout.close
sql="update jle_info set xurl = '"&NewsFile2&"', fbsj = '"&fbsj&"' where ID = "&ru("ID")
conn.execute(sql)
%>
<%=file2%>生成成功....ID：<%=x_id%><br>

<%
ru.movenext
loop
%>