📄 wapview.asp
字号:
<!--#include file="wapconn.asp"-->
<!--#include file="wapstr.asp"-->
<!--#include file="inc/md5.asp"-->
<%
response.ContentType="text/vnd.wap.wml;charset=utf-8"
Response.Expires = -1
Response.AddHeader "Pragma", "no-cache"
Response.AddHeader "Cache-Control", "no-cache, must-revalidate"
%><?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>
<card id="wapview" title="<%=converttowide("日志内容")%>">
<%
dim show_logid
dim topicx,usernamex,addtimex,logtextx,ispassword
show_logid=Clng(request("id"))
Dim logpassword,showlogpass
logpassword=request("logpassword")
if logpassword<>"" then
logpassword=md5(logpassword)
set rs=conn.execute("select id from blog where id="&show_logid&" and ispassword='"&logpassword&"'")
if rs.eof then
Response.write "<p>"
Response.Write (converttowide("对不起,日志密码错误!"))
Response.write "</p>"
else
showlogpass=true
end if
end if
dim sql,rs
sql="select topic,id,username,addtime,logtext,ispassword from blog where passcheck<>'false' and id="&show_logid
Set rs=conn.execute(SQL)
If not(rs.bof and rs.eof) then
topicx=rs(0)
usernamex=rs(2)
addtimex=rs(3)
logtextx=cutStr(rs(4),5000)
ispassword=rs(5)
end if
rs.close:Set rs=Nothing
dim msql,rsmain,userid
msql="select userid,username from [user] where username='"&usernamex&"'"
Set rsmain=Server.CreateObject("Adodb.RecordSet")
rsmain.Open msql,Conn,1,1
userid=rsmain(0)
dim page,PageLength,CLength,PageCount,wen,a
if Request("Page")<>"" then Page = CLng(Request("Page"))
PageLength = 500
CLength = Len(logtextx)
PageCount = Int(Clength/PageLength) + 1
if Page < 1 or IsNull(Page) Then Page = 1
if Page > PageCount Then Page = PageCount
if page=1 then
a=1
elseif page>1 then
a=(Page-1)*PageLength
end if
wen=Mid(logtextx,a,PageLength)
if ispassword<>"" and showlogpass<>true then
Response.write "<p align=""center"">"
Response.write (converttowide("本日志需要密码访问!"))&"<br/>"
Response.write (converttowide("请输入日志密码:"))&"<br/>"
Response.write "<input name=""logpassword"" type=""text""/>"&"<br/>"
Response.write "<anchor>"
Response.write (converttowide("提交"))
Response.write "<go href=""wapview.asp?ID="&show_logid&""" method=""post"">"
Response.write "<postfield name=""logpassword"" value=""$(logpassword)""/>"
Response.write "</go></anchor></p>"
else
if page="" or page=1 then
Response.write (converttowide("作者:"))
Response.write (converttowide(usernamex))&"<br/>"
Response.write (converttowide("发表时间:"))
Response.write addtimex&"<br/>"
Response.write (converttowide("标题:"))
Response.write (converttowide(topicx))&"<br/>"
Response.write (converttowide("内容:"))
end if
Response.write (converttowide(wen))
Response.write "<br/>"
Response.write (converttowide("本文字数:")) & CLength &"<br/>"
Response.write (converttowide("共分")) & PageCount & (converttowide("页"))&"<br/>"
if PageCount >1 and page <> 1 then
Response.write "<a href=""wapview.asp?ID="&show_logid&"&Page=1"">"&(converttowide("首页"))&"</a><br/>"
end if
dim j
For j=Page+1 To Page+10
if j <= PageCount-1 then
Response.write "<a href=""wapview.asp?ID="&show_logid&"&Page="&j&""">"&j&"</a><br/>"
end if
next
if PageCount >1 and Page <> PageCount then
Response.write "<a href=""wapview.asp?ID="&show_logid&"&Page="&PageCount&""">"&(converttowide("尾页"))&"</a><br/>"
End if
End if
Response.Write "<a href=""wapuser.asp?id="&userid&""">"&(converttowide("返还作者首页"))&"</a><br/>"
Response.Write "<a href=""wapblog.asp"">"&(converttowide("返还最新日志"))&"</a><br/>"
Response.Write "<a href=""wapuserlist.asp"">"&(converttowide("返还博客排行"))&"</a><br/>"
Response.Write"<a href=""wap.asp"">"&(converttowide("返还博客首页"))&"</a>"
%>
</p>
</card>
</wml>
<%
Function cutStr(str,strlen)
'去掉所有HTML标记
Dim re
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="<(.[^>]*)>"
str=re.Replace(str,"")
set re=Nothing
Dim l,t,c,i
l=Len(str)
t=0
For i=1 to l
c=Abs(Asc(Mid(str,i,1)))
If c>255 Then
t=t+2
Else
t=t+1
End If
If t>=strlen Then
cutStr=left(str,i)&"..."
Exit For
Else
cutStr=str
End If
Next
cutStr=Replace(cutStr,chr(10),"")
cutStr=Replace(cutStr,chr(13),"")
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -