﻿<!-- #include file="Inc/Inc.asp" -->
<!-- #include file="Inc/Function.asp" -->
<%'============================================================
' Copyright 2007-09 燃点真情. All Rights Reserved.
' Last Update: 2008-3-22  13:28
' ADD:wap.nowtx.cn
' E-Mail: xivn@163.com  QQ:531233814
'============================================================
Call Head()
Response.write "<card id='card1' title='下载TXT文本'>"
 Response.write "<p align='left'>"
 if myid=0 then
Response.write "<a href='login.asp?url="&Replace(Replace(R_url(),"sid=","o="),"sid=","o=")&"'>请您先登陆...</a>"& chr(13)
  Response.write "<br/><anchor><prev/>返回</anchor>" & chr(13)
  Response.write "</p></card></wml>"
  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>"
Response.write "<br/><anchor>取消<prev/></anchor>"
response.write "</p></card></wml>" 
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)
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"
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</p></card>
</wml>