分享首页调用代码超大全BBSXP5.15-5.16

By admin at 2007-05-26 • 0人收藏 • 991人看过

基本上都是网上的朋友写的,我整理一下,大家测试一下用着行吗.

如果好多多在这交流

1.调用论坛信息,包括主题总数,回 贴 数,注册人数,新进会员,论坛女生,论坛男生,今日帖数,昨日贴数,论坛在线,在线会员,在线游客
<script language="JavaScript" src="tongji.asp?type=1" type="text/JavaScript"></script>

2.调用发帖排行(参数n为显示排行前n名,不加参数n,默认显示发帖排行前10名会员)
<script language="JavaScript" src="tongji.asp?type=2&n=5" type="text/JavaScript"></script>

3.调用最新加入会员(参数n为显示最新加入前n名,不加参数n,默认显示最后10名加入会员)
<script language="JavaScript" src="tongji.asp?type=3&n=5" type="text/JavaScript"></script>

4.帖子调用(参数n为显示最新n个帖子,不加参数n,默认显示为10,showtime-是否显示发帖时间,1-显示 省略为不显示 showuser-是否显示作者 1-显示 省略为不显示,cnum-标题长度,省略默认为20个字符,re-调用最高回复帖子 1为显示 good-调用精华帖子 1为显示 )

a.调用论坛最新帖子
<script language="JavaScript" src="tongji.asp?type=4&n=5&showtime=1&showuser=1&cnum=10" type="text/JavaScript"></script>

b.调用论坛最高回复
<script language="JavaScript" src="tongji.asp?type=4&n=5&showtime=1&showuser=1&cnum=10&re=1" type="text/JavaScript"></script>

c.调用论坛精华帖子
<script language="JavaScript" src="tongji.asp?type=4&n=5&showtime=1&showuser=1&cnum=10&good=1" type="text/JavaScript"></script>

d.调用最高点击帖子
<script language="JavaScript" src="tongji.asp?type=4&n=5&showtime=1&showuser=1&cnum=10&view=1" type="text/JavaScript"></script>

e.调用论坛版块帖子(只需要在上面对应的调用中在加入一个参数&forumid=就可以了,forumid为调用的版块id)

5.公告调用((参数n为显示最新n个公告,不加参数n,默认显示为10,pl-显示方式 1-横行显示 0-竖排显示 不加pl参数默认为横行显示)
<script language="JavaScript" src="tongji.asp?type=5&n=5&pl=0" type="text/JavaScript"></script>

公告滚动显示的方法:
1.横行显示
<marquee onmouseover="this.stop()" onmouseout="this.start()" width="90%" scrollamount="3"><script language="JavaScript" src="tongji.asp?type=5&n=3" type="text/JavaScript"></script></marquee>
其中width=根据自己的页面需要调整

2.竖排显示
<MARQUEE width=155 height=120
      border="0" onmouseover='this.stop()'  onmouseout='this.start()'><script language="JavaScript" src="tongji.asp?type=5&n=3&pl=0" type="text/JavaScript"></script></marquee>
其中width=和height=根据自己的需要调整

另外需要一个名称为tongji.asp的文件,把下面的代码自己生成就行了

<!--#include file="conn.asp"-->
<%
dim showtype,CacheName,today,oldday,online,n,showtime,showuser,cnum,re,good,forumid,pl
showtype=request.QueryString("type")

select case showtype
case "1"
Set rs=Server.CreateObject("ADODB.Connection")
rs.open ConnStr
CacheName=rs.execute("Select CacheName from clubconfig")(0)
today=rs.execute("Select today from clubconfig")(0)
yesterday=rs.execute("Select oldday from clubconfig")(0)
online=rs.execute("Select count(sessionid)from online")(0)
regonline=rs.execute("Select count(sessionid)from online where username<>''")(0)
if Application(CacheName&"CountForum")=empty then
   Application(CacheName&"CountForum")=rs.execute("Select count(id)from [forum]")(0)
end if
if Application(CacheName&"CountReforum")=empty then
   Application(CacheName&"CountReforum")=rs.execute("Select count(id)from [Reforum]")(0)
end if
if Application(CacheName&"CountUser")=empty then
   Application(CacheName&"CountUser")=rs.execute("Select count(id)from [user]")(0)
end if
if Application(CacheName&"NewUserName")=empty then
   Application(CacheName&"NewUserName")=rs.execute("Select top 1 username from [user] order by id desc")(0)
end if

function allboys() 
dim tmprs 
    tmprs=rs.execute("Select count(id) from [user] where sex='male' ") 
    allboys=tmprs(0) 
 set tmprs=nothing 
 if isnull(allboys) then allboys=0 
end function

function allgirls() 
dim tmprs 
    tmprs=rs.execute("Select count(id) from [user] where sex='female' ") 
    allgirls=tmprs(0) 
 set tmprs=nothing 
 if isnull(allgirls) then allgirls=0 
end function

%>
 document.write('□- 主题总数 <font color=green><%=Application(CacheName&"CountForum")%></font><br> □- 回 贴 数 <font color=green><%=Application(CacheName&"CountReforum")%></font><br> □- 注册人数 <font color=green><%=Application(CacheName&"CountUser")%></font><br> □- 新进会员 <font color=red><%=Application(CacheName&"NewUserName")%></font><br> □- 论坛女生 <%=allgirls()%> 位<br> □- 论坛男生 <%=allboys()%> 位<br>□- 今日帖数 <font color=red><%=today%></font><br> □- 昨日贴数 <font color=green><%=yesterday%></font><br> □- 论坛在线 <font color=red><%=online%></font><br>□- 在线会员 <font color=red><%=regonline%></font><br>□- 在线游客 <font color=red><%=online-regonline%></font><br>');
<%
conn.close
set conn=nothing

case "2"
n=request.QueryString("n")
if n="" then
   n=10
end if
set rs=server.createobject("adodb.recordset")
sql="select top "&n&" id,username from [user] order by posttopic+postrevert desc,id"
rs.open sql,ConnStr,1,1
    do while Not RS.Eof
    response.write "document.write('<FONT color=#b70000>□</FONT><span style=""font-size:9pt;line-height: 15pt""><a href=profile.asp?username="& rs(1) &" target=_blank title=查看"&rs(1)&"的个人资料>');"
    response.write "document.write('"&rs(1)&"</a>');"
    response.write "document.write('</span><br>');"
    rs.MoveNext
    Loop
    rs.close
    set rs=nothing
    conn.close
    set conn=nothing

case "3"
n=request.QueryString("n")
if n="" then
   n=10
end if
set rs=server.createobject("adodb.recordset")
sql="select top "&n&" id,username from [user] order by id desc"
rs.open sql,conn,1,1
 do while Not RS.Eof
 response.write "document.write('<FONT color=#b70000>□</FONT><span style=""font-size:9pt;line-height: 15pt""><a href=profile.asp?username="& rs(1) &" target=_blank title=查看"&rs(1)&"的个人资料>');"
    response.write "document.write('"&rs(1)&"</a>');"
 response.write "document.write('</span><br>');"
 rs.MoveNext
 Loop
 rs.close
 set rs=nothing
 conn.close
 set conn=nothing
 
case "4"
n=request.QueryString("n")
if n="" then
  n=10
end if
forumid=request.QueryString("forumid")
re=request.QueryString("re")
view=request.QueryString("view")
good=request.QueryString("good")
cnum=request.QueryString("cnum")
if cnum="" then
   cnum=20
end if
showtime=request.QueryString("showtime")
showuser=request.QueryString("showuser")
set rs=server.createobject("adodb.recordset")
if forumid=empty then
   if re<>empty then
             sql="select top "&n&" * from [forum] where deltopic=0 order by replies desc,id"
   end if
  
   if view<>empty then
             sql="select top "&n&" * from [forum] where deltopic=0 order by Views desc,id"
   end if
  
   if good<>empty then
             sql="select top "&n&" * from [forum] where deltopic=0 and goodtopic=1 order by id desc"
   end if
  
   if re=empty and view=empty and good=empty then
             sql="select top "&n&" * from [forum] where deltopic=0 order by id desc"
   end if
else
   if re<>empty then
             sql="select top "&n&" * from [forum] where deltopic=0 and forumid="&forumid&" order by replies desc,id"
   end if
  
   if view<>empty then
             sql="select top "&n&" * from [forum] where deltopic=0 and forumid="&forumid&" order by Views desc,id"
   end if
  
   if good<>empty then
             sql="select top "&n&" * from [forum] where deltopic=0 and forumid="&forumid&" and goodtopic=1 order by id desc"
   end if
  
   if re=empty and view=empty and good=empty then
             sql="select top "&n&" * from [forum] where deltopic=0 and forumid="&forumid&" order by id desc"
   end if
end if
  
rs.open sql,conn,1,1
 do while Not RS.Eof
 response.write "document.write('<span style=""font-size:9pt;line-height: 15pt""><a href=showpost.asp?id="&rs(0)&" target=_blank title=点击查看帖子内容>');"
    response.write "document.write('"&CutStr(rs(2),cnum)&"</a>');"
 response.write "document.write('</span>');"
 if showuser<>"1" and showtime<>"1" then
  response.write "document.write('<br>');"
    end if
 if showuser="1" and showtime<>"1" then
  response.write "document.write('<br>');"
    end if
 if showuser="1" then
 response.write "document.write('  <span style=""font-size:9pt;line-height: 15pt""><a href=profile.asp?username="&rs(3)&" target=_blank title=查看"&rs(3)&"的个人资料>');"
    response.write "document.write('"&rs(3)&"</a>');"
 response.write "document.write('</span>');"
    end if
 if showtime="1" then
 response.write "document.write('  <span style=""font-size:9pt;line-height: 15pt"">"&rs(5)&"</span><br>');"
    end if

 rs.MoveNext
 Loop
 rs.close
 set rs=nothing
 conn.close
 set conn=nothing

Function CutStr(byVal Str,byVal StrLen)
 Dim l,t,c,i
 l=Len(str)
 t=0
 For i=1 To l
  c=AscW(Mid(str,i,1))
  If c<0 Or c>255 Then t=t+2 Else t=t+1
  IF t>=StrLen Then
   CutStr=left(Str,i)&"..."
   Exit For
  Else
   CutStr=Str
  End If
 Next
End Function

case "5"
n=request.QueryString("n")
pl=request.QueryString("pl")
if pl="" then
   pl="1"
end if
if n="" then
   n=10
end if
set rs=server.createobject("adodb.recordset")
sql="select top "&n&" * from [affiche] order by id desc"
rs.open sql,conn,1,1
 do while Not RS.Eof
if pl="1" then
 response.write "document.write('<span style=""font-size:9pt;line-height: 15pt""><a href=affiche.asp target=_blank title=点击查看公告>');"
    response.write "document.write('"&rs(1)&"  ("&rs(4)&")</a>');"
 response.write "document.write('</span>        ');"
else
 response.write "document.write('<span style=""font-size:9pt;line-height: 15pt""><a href=affiche.asp target=_blank title=点击查看公告>');"
    response.write "document.write('"&rs(1)&"  ("&rs(4)&")</a>');"
 response.write "document.write('</span><br>');"
end if
 rs.MoveNext
 Loop
 rs.close
 set rs=nothing
 conn.close
 set conn=nothing


   
end select
%>

登录后方可回帖

登 录
信息栏

Carbon Forum是一个基于话题的高性能轻型PHP论坛

下载地址:Carbon Forum v5.9.0
QQ群:12607708(QQ我不常上)

donate

手机支付宝扫描上方二维码可向本项目捐款

粤公网安备 44030602003677号
粤ICP备17135490号

Loading...