📄 chapter_class.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="request.asp"-->
<%
cid=request("cid")
page=request("page")
if page="" then
page=1
end if
Set rs= Server.CreateObject("adodb.recordset")
Rs.open "select * from "&prefix&"bookchapter where id="&cid&"" ,conn,1,1
lj=rs("booktexttype")
title=rs("booktitle")
bookid=rs("bookid")
nclass=rs("nclass")
booktexttitle=rs("booktexttitle")
rs.close
set fso=server.CreateObject("Scripting.FileSystemObject")
Set f=fso.OpenTextFile(Server.MapPath(lj))
s=replace(RemoveHTML(f.readall),"&","")
s=replace(s,"nbsp;","")
f.close
set f=nothing
set fso=nothing
totalpage=int(len(s)/pnum)+1
if page-totalpage>=0 then
page=totalpage
end if
if page=1 then
start_s=1
else
start_s=(page-1)*pnum
end if
content=mid(s,start_s,pnum)
Set rs= Server.CreateObject("adodb.recordset")
Rs.open "select * from "&prefix&"bookchapter where bookid="&bookid&" order by id asc" ,conn,1,1
do while not rs.eof
N=N+1
if rs("id")&"a"=cid&"a" then
exit do
end if
rs.movenext '显示页面的数据
loop
if N=1 then
ppage=0
else
rs.absoluteposition=N-1
ppage=rs("id")
end if
if N=rs.recordcount then
npage=0
else
rs.absoluteposition=N+1
npage=rs("id")
end if
if page=1 then
c_page="<a href=""chapter.asp?cid="&cid&"&page="&page+1&"&pnum="&pnum&"&uid="&uid&"&ups="&ups&""">下页</a>"
elseif page=totalpage then
c_page="<a href=""chapter.asp?cid="&cid&"&page="&page-1&"&pnum="&pnum&"&uid="&uid&"&ups="&ups&""">上页</a>"
else
c_page="<a href=""chapter.asp?cid="&cid&"&page="&page+1&"&pnum="&pnum&"&uid="&uid&"&ups="&ups&""">下页</a> <a href=""chapter.asp?cid="&cid&"&page="&page-1&"&pnum="&pnum&"&uid="&uid&"&ups="&ups&""">上页</a>"
end if
if page=1 and page=totalpage then
c_page=""
end if
if ppage&"a"=0&"a" then
n_page="<a href=""chapter.asp?cid="&npage&"&page=1&pnum="&pnum&"&uid="&uid&"&ups="&ups&""">下章</a>"
elseif npage&"a"=0&"a" then
n_page="<a href=""chapter.asp?cid="&ppage&"&page=1&pnum="&pnum&"&uid="&uid&"&ups="&ups&""">上章</a>"
else
n_page="<a href=""chapter.asp?cid="&npage&"&page=1&pnum="&pnum&"&uid="&uid&"&ups="&ups&""">下章</a> <a href=""chapter.asp?cid="&ppage&"&page=1&pnum="&pnum&"&uid="&uid&"&ups="&ups&""">上章</a>"
end if
bid=bookid
%>
<%
Function RemoveHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
'取闭合的<>
objRegExp.Pattern = "<.+?>"
'进行匹配
Set Matches = objRegExp.Execute(strHTML)
' 遍历匹配集合,并替换掉匹配的项目
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
RemoveHTML=strHTML
Set objRegExp = Nothing
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -