<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->

<%call head()

Call saycarda("下载帖子")


dim tid
tid=request("tid")
if tid="" or Isnumeric(tid)=false then
  Call Error("ID无效！")
end If


downxx=request("downxx")

If downxx="" Then
 Response.Write "<a href='downtxt.asp?downxx=ok&amp;tid="&tid&"&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;path="&path&"'>确定下载</a>(费用88"&getcent&")"

 Response.Write "<br/><a href='topic.asp?tid="&tid&"&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;path="&path&"'>放弃操作</a><br/>"

else

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from sell where id="&tid,conn,1,1

'过滤论坛的换行符USBCODE
function usbcode(str)
	str=trim(str)
	if IsNull(str) then exit function
	str=replace(str,"<br/>","\\")
	str=replace(str,"(br)","\\")
	str=replace(str,"[br]","\\")
	str=replace(str,"[tid]","")
	str=replace(str,"@@sid@@","")
	usbcode=str
end function
 Dim fs,yd
yd=""&rs("name")&""
yd =  yd & chr(13) & chr(10)
yd=yd &"来源:"&bbstitle&""
yd =  yd & chr(13) & chr(10)
	dim ccc,sss
	ccc=instr(usbcode(rs("txt")),"\\")
	if ccc>0 then
	sss=split(usbcode(rs("txt")),"\\")
for i=0 to ubound(sss)
yd =  yd & chr(13) & chr(10)
yd=yd & sss(i)
next
else
yd=yd &rs("txt")
end if
yd =  yd & chr(13) & chr(10)
yd =  yd & "-------"
yd =  yd & chr(13) & chr(10)
yd =  yd & chr(13) & chr(10)
yd =  yd & chr(13) & chr(10)
yd =  yd & "时间:"&rs("tm")
yd =  yd & chr(13) & chr(10)
yd =  yd & "作者:"&rs("fname")&"ID:("&rs("fid")&")"
yd =  yd & chr(13) & chr(10)
yd =  yd & ""&waptitle&""
yd =  yd & chr(13) & chr(10)
yd =  yd & request.ServerVariables("Server_NAME")
yd =  yd & chr(13) & chr(10)

set fs=server.CreateObject("scripting.FileSystemObject")
set xTextFile=fs.CreateTextFile(Server.MapPath("file/"&request.ServerVariables("Server_NAME")&".txt"),1,true)
xTextFile.write(""&yd&"")
response.redirect "file/"&request.ServerVariables("Server_NAME")&".txt"
rs.close
set rs=Nothing
End if
conn.close
set conn=nothing
Call head1()
%>
