📄 read.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% Response.ContentType="text/vnd.wap.wml" %><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta http-equiv='Cache-Control' content='no-cache'/>
</head>
<%
dim n,a
n=request("n")
if n="" then n=1
a=request("a")
Function Bytes2bStr(vin)
if lenb(vin) =0 then
Bytes2bStr = ""
exit function
end if
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject("ADODB.Stream")
BytesStream.Type = 2
BytesStream.Open
BytesStream.WriteText vin
BytesStream.Position = 0
BytesStream.Charset = "gb2312"
BytesStream.Position = 2
StringReturn = BytesStream.ReadText
BytesStream.close
Set BytesStream = Nothing
Bytes2bStr = StringReturn
End Function
Dim F,File,starttime,PageSize,Page,TotalLength,TotalPage,Content,Position_S
starttime = timer()
pagesize = request("zhishu")
if request("zhishu")="" then PageSize = 500
Page = Request("Page")
If Page = "" Or Not IsNumeric(Page) Then Page = 1
Page = Cint(Page)
If Page < 1 Then Page = 1
set s = server.createobject("adodb.stream")
s.mode = 3
s.type = 2
s.open
s.loadfromfile(SERVER.MAPPATH(""&request("url")&""))
Content1 = Replace(Bytes2bStr(s.ReadText),"<br/>",VBcrlf)
Content1 = Replace(Content1," "," ")
if len(content1)\pagesize=len(content1)/pagesize then
TotalPage=len(content1)\pagesize
else
TotalPage=len(content1)\pagesize+1
end if
if page>totalpage then page=totalpage
if page=1 then
content = mid(content1,1,pagesize)
else
content = mid(content1,pagesize*(page-1),pagesize)
end if
Content = Replace(content,"&","&")
Content = Replace(Content," "," ")
Content = Replace(Content," "," ")
Content = Replace(Content,"'","'")
Content = Replace(Content,"<","<")
Content = Replace(Content,">",">")
Content = Replace(Content,VBcrlf,"<br/>")
%>
<card title='<%ContentStrtitle(request("url"))%>'>
<%Response.Write "<p>文件大小:" & len(content1) & "字 每页" & PageSize & "字 共" & TotalPage & "页 当前第" & Page & "页<br/>"
if page>1 then%>
<a href="read.asp?url=<%ContentStr1(request("url"))%>&a=<%=a%>&n=<%=n%>&zhishu=<%=pagesize%>">首页</a> <a href="read.asp?Page=<%=Page-1%>&url=<%ContentStr1(request("url"))%>&a=<%=a%>&n=<%=n%>&zhishu=<%=pagesize%>">上页</a>
<% end if
if page<TotalPage then%>
<a href="read.asp?Page=<%=Page+1%>&url=<%ContentStr1(request("url"))%>&a=<%=a%>&n=<%=n%>&zhishu=<%=pagesize%>">下页</a> <a href="read.asp?Page=<%=TotalPage%>&url=<%ContentStr1(request("url"))%>&a=<%=a%>&n=<%=n%>&zhishu=<%=pagesize%>">尾页</a>
<% end if %>
<br/>字数设定
<br/>-----------<br/> <%=Content%><br/>
-----------<br/><% if page>1 then%>
<a href="read.asp?url=<%ContentStr1(request("url"))%>&a=<%=a%>&n=<%=n%>&zhishu=<%=pagesize%>">首页</a> <a href="read.asp?Page=<%=Page-1%>&url=<%ContentStr1(request("url"))%>&a=<%=a%>&n=<%=n%>&zhishu=<%=pagesize%>">上页</a>
<% end if
if page<TotalPage then%>
<a href="read.asp?Page=<%=Page+1%>&url=<%ContentStr1(request("url"))%>&a=<%=a%>&n=<%=n%>&zhishu=<%=pagesize%>">下页</a> <a href="read.asp?Page=<%=TotalPage%>&url=<%ContentStr1(request("url"))%>&a=<%=a%>&n=<%=n%>&zhishu=<%=pagesize%>">尾页</a>
<% end if
response.write "<br/>"
if TotalPage>3 then
%>页数<input name="ye" type="text" format="*N" emptyok="true" size="5" maxlength="10"/><anchor>跳到
<go href="read.asp?url=<%ContentStr1(request("url"))%>&a=<%=a%>&n=<%=n%>&zhishu=<%=pagesize%>">
<postfield name="page" value="$(ye)"/>
</go>
</anchor><br/>
<% end if
Dim fso, fa, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set fa = fso.GetFolder(server.mappath(""& request("url") &"/../"))
set fs=fa.SubFolders
Set fc =fa.Files
For Each fss in fs
dim folder_name
folder_name=fss.name
Next
dim i,sfile
sfile=fa.files.count
i=1
For Each f1 in fc
dim filename
filename=f1.name
if i=(a+1) then
%>
下一章
<% end if
if i=(a-1) then
%>
上一章
<% end if
i=i+1
Next
%><br/>
<a href="writeping.asp?url=<%=ContentStrurl(request("url"))%>&name=<%=ContentStrname(request("url"))%>.txt&a=<%=a%>&n=<%=n%>">发表评论</a><br/>
<a href="readping.asp?url=<%=ContentStrurl(request("url"))%>&name=<%=ContentStrname(request("url"))%>.txt&a=<%=a%>&n=<%=n%>">查看评论</a><br/>
<a href='sj2.asp?url=<%ContentStr(request("url"))%>&n=<%=n%>'>返回上级</a><br/>
<a href="index.asp">返回首页</a><br/>
<%
Response.write "执行花了:" & (timer - starttime)*1000 & "ms"
function ContentStrtitle(q_path)
dim constr,constr1,constr2
constr=split(q_path,"/")
constr1=ConStr(ubound(ConStr))
constr2=split(constr1,".")
response.write constr2(0)
end function
function ContentStrname(q_path)
dim constr
constr=split(q_path,"/")
response.write ConStr(ubound(ConStr)-1)
end function
function ContentStr(q_path)
dim constr
constr=split(q_path,"/")
For j=0 to (ubound(ConStr)-2)
response.write ""& server.urlencode(ConStr(j)) &"/"
next
response.write server.urlencode(ConStr(ubound(ConStr)-1))
end function
function ContentStr1(q_path)
dim constr,constr1
constr=split(q_path,"/")
For j=0 to (ubound(ConStr)-1)
response.write ""& server.urlencode(ConStr(j)) &"/"
next
constr1=split(ConStr(ubound(ConStr)),".")
For k=0 to (ubound(ConStr1)-1)
response.write ""& server.urlencode(ConStr1(k)) &"."
next
response.write ""& ConStr1(ubound(ConStr1)) &""
end function
function ContentStrfile(q_path)
dim constr,constr1
constr=split(q_path,"\")
For j=(ubound(ConStr)-n-2) to (ubound(ConStr)-1)
response.write ""& Server.URLEncode(ConStr(j)) &"/"
next
constr1=split(ConStr(ubound(ConStr)),".")
For k=0 to (ubound(ConStr1)-1)
response.write ""& Server.URLEncode(ConStr1(k)) &"."
next
response.write ConStr1(ubound(ConStr1))
end function
function ContentStrurl(q_path)
dim constr,constr1
constr=split(q_path,"/")
For j=0 to (ubound(ConStr)-1)
response.write ""& Server.URLEncode(ConStr(j)) &"/"
next
constr1=split(ConStr(ubound(ConStr)),".")
For k=0 to (ubound(ConStr1)-1)
response.write ""& Server.URLEncode(ConStr1(k)) &"."
next
response.write ConStr1(ubound(ConStr1))
end function
function p2v_path(p_path)
'p_path为硬盘上的物理路径
dim host
host=lcase(server.MapPath("\"))
p_path=lcase(p_path)
p2v_path=replace(p_path,host,"")
end function
%>
</p></card></wml>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -