说明三点:
1、txt文件下载到电脑里完全可以正常查看
2、已经测试了把txt另存为所有的编码格式
3、程序是调用服务器上的TXT文件,读取文件内容,前台输出显示。
乱码截图如下:
相关代码:
<!--#include file="const.asp"-->
<%Function main
dim rs,sql,i,id,PageCount,Page,PageOut,PageIn,PageSize,content,classid,RepCount,gm,viphy,nid,read,readtime
PageSize=500
id=Request.QueryString("id")
if id="" then id=0
if not isnumeric(id) then id=0
id=clng(id)
Page = Request("page") '当前页数
If Page = "" Then Page = 1
If Not IsNumeric(Page) Then Page = 1
Page = CLng(Page)
If Page < 1 Then Page = 1
if xy<>"Null" then
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql = "select vip,id from xywap_user where xy='"&md5(xy) & md5(strReverse(xy))&"'"
Rs.Open Sql,conn,1,1
if not (rs.bof and rs.eof) then
viphy=rs("vip")
nid=rs("id")
end if
Rs.close
Sql = "select id from xywap_goumai where ext=2 and listid="&id&" and nid="&nid&""
Rs.Open Sql,conn,1,1
if not (rs.bof and rs.eof) then
gm=1
else
gm=0
end if
Rs.close
set rs=nothing
else
viphy=0
gm=0
end if
conn.execute("update xywap_view_list set ReadCount=ReadCount+1 where id="&id&"")
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql = "select name,classid,Urls,zuozhe,laiyuan,RepCount,ReadCount,[WriteTime],[readtime],tuijian,vip,zf,viphy,vipgm from xywap_view_list where id="&id
Rs.Open Sql,conn,1,1
if not (rs.bof and rs.eof) then
readtime=rs("readtime")
Dim path,FsoObj,tempfileOBJ,txt
Path = server.mappath(Request.ServerVariables("SCRIPT_NAME"))
Path=left(Path,instrrev(Path,"\" ) - 1 )
path=Path & "/" & RS("urls")
Set FsoObj=Server.CreateObject("Scripting.FileSystemObject")
IF FSOObj.FileExists(path) = True then
Set tempfileOBJ = FsoObj.OpenTextFile(path, 1, 0, 0 )
While NOT tempfileOBJ.AtEndOfStream
txt=txt & tempfileOBJ.ReadLine & vbNewLine
Wend
Set tempfileOBJ=Nothing
end if
Set FsoObj=Nothing
if len(txt)>2 then txt=trim(left(txt,len(txt)-2))
if viphy=1 then
if rs("vipgm")=1 then
if gm=1 then
read=true
else
read=false
end if
else
read=true
end if
elseif rs("viphy")=1 then
read=false
elseif rs("vip")=1 then
if gm=1 or rs("zf")=0 then
read=true
else
read=false
end if
else
read=true
end if
RepCount=rs("RepCount")
classid=rs("classid")
content=txt
if Request.QueryString("act")<>1 then
''''''''''''''''''智能分页''''''''''''''''''''''
Dim n
I = 1
Do
n = n + 1
If n = page Then
PageIn = I
End If
If InStr(I, content, " |