<!-- #include file="Inc/Inc.asp" -->
<!-- #include file="Inc/Function.asp" -->
<%
Call Head()
Call saycarda("下载TXT文本")


 if myid=0 then
Response.write "<a href='login.asp?url="&Replace(R_url(),"sid=","sidoo=")&"'>请您先登陆...</a>"& chr(13)

  Call Previous("返回")
Call headsay()
  Response.end
end if
 
dim id,ids,p
id=request("id")
ids=request("class")
p=request("p")
if id="" or isnumeric(id)=False then
Call Error("ID无效！")
end if
if ids="" or isnumeric(ids)=False then
Call Error("ID无效！")
end if
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from sms where id="&id,conn,1,1

set rs1=Server.CreateObject("ADODB.Recordset")
rs1.open"select * from WzClass where classid="&rs("classid"),conn,1,1
pid=rs1("pid")
rs1.close
set rs1=nothing

if clng(pid)<>0 and keys<>1 then
if request("action")<>"ok" then
response.write "文章:"&rs("title")
response.write "<br/>下载此文章TXT需用"&abs(pid)&getcent&",确定要下载吗？"
response.write "<br/><a href='downtxt.asp?action=ok&amp;class="&ids&"&amp;id="&id&"&amp;sid="&sid&"'>是的</a>"
  Call Previous("取消")
Call headsay()
response.end
end if
if abs(myjb)<abs(int(pid)) then
Call Error("您的"&getcent&"不足下载这个TXT！")
end if
conn.execute("update Users Set myjb = myjb - "&abs(int(pid))&" where ID="&myid)
end if
'过滤的换行符USBCODE
function usbcode(str)
	str=trim(str)
	if IsNull(str) then exit function
	str=replace(str,"<br/>",chr(13) & chr(10))
	str=replace(str,"(br)",chr(13) & chr(10))
	str=replace(str,"[br]",chr(13) & chr(10))
	str=replace(str,"\\",chr(13) & chr(10))
	usbcode=str
end function

yd =  yd & ubb(rs("title"))
yd =  yd & chr(13) & chr(10)
yd =  yd & "-------"
yd =  yd & chr(13) & chr(10)
yd =  yd & rs("YD_date")
yd =  yd & chr(13) & chr(10)
yd =  yd &"来源:"& request.ServerVariables("Server_NAME")
yd =  yd & chr(13) & chr(10)
yd =  yd & "-------"
yd =  yd & chr(13) & chr(10)
yd=yd &usbcode(rs("test"))

yd =  yd & chr(13) & chr(10)
yd =  yd & chr(13) & chr(10)
yd =  yd & "-------"
yd =  yd & chr(13) & chr(10)
yd =  yd & "本TXT下载于"&now()
yd =  yd & chr(13) & chr(10)
yd =  yd & "http://"&request.ServerVariables("Server_NAME")
yd =  yd & chr(13) & chr(10)
yd =  yd & waptitle
yd =  yd & chr(13) & chr(10)
rs.close
set rs=nothing
conn.close
set conn=nothing
set fs=server.CreateObject("scripting.FileSystemObject")
set xTextFile=fs.CreateTextFile(Server.MapPath("/wml/txtsms.txt"),1,true)
xTextFile.write(""&yd&"")
response.redirect"http://"&request.ServerVariables("Server_NAME")&"/wml/txtsms.txt"
Call headsay()
%>
