std_news.asp
来自「前台及后台用户名密码都是:gz35gz35.com」· ASP 代码 · 共 67 行
ASP
67 行
<!--#include file="conn.asp"-->
<%
Dim NewsNum,Bid,Sqlstr,SQL,rs,Action,Pos
Dim bbsurl,lockurl,thisurl
lockurl=""
'允许调用的站点,为空则允许全部站点(多网址以","分隔)
'例如只允许此两个网址调用: lockurl="www.xpstill.com,www.stardy.com"
bbsurl=""
'你论坛绝对地址,要以"HTTP://"开头,如bbsurl="http://www.xpstill.com/bbs",为空则使用相对地址。
'******************************************************************************************
thisurl=Request.ServerVariables("HTTP_REFERER")
Pos=InstrRev(thisurl,"/")-1
If Pos>0 Then thisurl=left(thisurl,Pos)
bbsurl=IIf(Lcase(bbsurl)=Lcase(thisurl),"",bbsurl)
Action=Lcase(Request.querystring("Action"))
Response.write"<?xml version=""1.0"" encoding=""GB2312"" ?>"
Response.write"<stardy>"
Call News()
Response.write "</stardy>"
Sub News()
NewsNum=Request.querystring("num")
If Not isNumeric(NewsNum) or NewsNum="" Then NewsNum="0"
Bid=Request.querystring("boardid")
Bid=IIf(Trim(Bid)<>"" and isNumeric(Bid),Bid,"0")
Sqlstr=" where boardid="&Bid
If CheckServer(lockurl)=false then
call bbsNews("数据被保护,禁止被其他站点调用!","","","")
Exit Sub
End if
SQL="select"&IIf(NewsNum="0",""," top "&NewsNum)&" boardid,title,username,addtime,id from Dv_bbsnews "&Sqlstr&" order by id desc"
ConnectionDatabase
Set Rs=conn.execute(sql)
If Rs.eof Then
call bbsNews("当前没有公告","announcements.asp?action=showone&boardid="&Bid,"","")
Else
Dim I : I=1
do while not rs.eof
call bbsNews(I&"."&rs(1),"announcements.asp?action=showone&boardid="&rs(0)&"&id="&rs(4),rs(2),rs(3))
rs.movenext
I=I+1
Loop
End If
End Sub
Function IIf(a,b,c)
If a=true Then IIf=b Else IIf=c
End Function
Function CheckServer(str)
CheckServer=True
If str="" Then Exit Function
Dim ServerName
ServerName = Request.ServerVariables("HTTP_REFERER")
If ServerName="" Then Exit Function
ServerName = Split(Replace(Lcase(ServerName),"http://",""),"/")(0)
CheckServer = Instr(","+Replace(Lcase(str),"http://","")+",",servername)>0
End Function
Sub bbsNews(b,u,e,t)
Response.write VbCrlf&"<news><newstitle><![CDATA["&b&"]]></newstitle><url><![CDATA["&u&"]]></url>"&_
"<writter>"&e&"</writter><time><![CDATA["&t&"]]></time></news>"&VbCrlf
End Sub
Class Cls_Forum
End Class
Class Cls_Templates
End Class
Class Cls_UserOnlne
End Class%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?