网站首页调用代码大全(bbsxp论坛程序)
<P align=center>网站首页调用代码大全(bbsxp论坛程序)</P><P>你先将下列代码存为一个asp文件,放到你网站根目录下运行一番,看看效果如何?<BR>再选择其中你需要的代码段,置入你的网站首页。</P><P>注意无论你调用什么,其中“连接数据库”和“撤除连接”这两段代码是一定要有的,分别放在首尾。<BR>如果调有帖子(新帖│回帖│热帖│精华),则“调帖显示子程序”这段也一定要有。</P><P>特别注意:<FONT color=#ff0000>BBSDIR="bbsxp"</FONT>双引号中的子目录名,是你放论坛的目录,要根据你站实际来填!<BR><BR><FONT color=#ff0000>Db = "../database/bbsxp7.mdb" </FONT>中的路径,一定要写你站的实际路径!<BR><BR>你先看清楚你站论坛的数据库到底放哪了?如果放在网站根目录的父目录(这是利于防黑的正确放法,很多新站长却浑然不知),那就是“Db = "../放库的父目录名/库文件名"这样子。如果放在论坛默认的database子目录下,那就是Db = "论坛目录名/放库子目录名/库文件名"了。搞错则连不上数据库。</P><P><html><BR><head><BR><title>首页调用测试...</title><BR><style type="text/css"><BR>a,td,p {font-size:9pt;}<BR>a {text-decoration:none;}<BR></style><BR></head><BR><body vlink="#00AA66"></P><P><FONT color=#ff0000><%<BR>BBSDIR="bbsxp"<BR>Db = "../database/BBSxpAdd.mdb"<BR>Set Conn=Server.CreateObject("ADODB.Connection")<BR>Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(Db)<BR>SqlNowString="Now()"<BR>%></FONT></P><P><FONT color=#ff0000>●调用新发帖:<BR><br><BR><%<BR>Sql="Select top 5 * From Where IsDel=0 Order By ID Desc"<BR>TopicList<BR>%><BR><br></FONT></P><P><FONT color=#ff0000>●调用新回帖:<BR><br><BR><%<BR>Sql="Select top 5 * From Where IsDel=0 and Replies>0 Order By LastTime Desc"<BR>TopicList<BR>%><BR><br></FONT></P><P><FONT color=#ff0000>●调用热门帖:<BR><br><BR><%<BR>Sql="Select top 5 * From Where IsDel=0 and PostTime>"&SqlNowString&"-7 Order by Replies Desc,ID"<BR>TopicList<BR>%><BR><br></FONT></P><P><FONT color=#ff0000>●调用精华帖:<BR><br><BR><%<BR>Sql="Select top 5 * From Where IsDel=0 and IsGood>0 Order by LastTime Desc"<BR>TopicList<BR>%><BR><br></FONT></P><P><FONT color=#ff0000><%<BR>'调帖显示子程序:<BR>Sub TopicList<BR>Set Rs=Conn.ExeCute(Sql)<BR>Do While Not Rs.Eof<BR>Response.Write "<a href="&BBSDIR&"/ShowPost.asp?ThreadID="&Rs("ID")&">★ "&Left(""&Rs("Topic")&"",15)&"</a><br>"<BR>Rs.MoveNext<BR>Loop<BR>Rs.Close<BR>End Sub<BR>%><BR><br></FONT></P><P><FONT color=#ff0000>●调用专题:<BR><br><BR><%<BR>Sql="Select * From Where TolSpecialTopic>''"<BR>Set Rs=Conn.ExeCute(Sql)<BR>Do While Not Rs.Eof<BR>ForumID=Rs("ID")<BR>Response.Write "<a href="&BBSDIR&"/ShowForum.asp?ForumID="&ForumID&">★"&Rs("ForumName")&"</a><br>"<BR>filtrate=split(Rs("TolSpecialTopic"),"|")<BR>for i = 0 to ubound(filtrate)<BR>Response.Write "[<a href="&BBSDIR&"/ShowForum.asp?ForumID="&ForumID&"&SpecialTopic="&filtrate(i)&">"&filtrate(i)&"</a>]<br>"<BR>next<BR>Rs.MoveNext<BR>Loop<BR>Rs.Close<BR>%><BR><br></FONT></P><P><FONT color=#ff0000>●调用新日志(博客):(适用于7.0)<BR><br><BR><%<BR>Sql="Select top 5 * From Order By ID Desc"<BR>Set Rs=Conn.ExeCute(Sql)<BR>Do While Not Rs.Eof<BR>Response.Write "<a href="&BBSDIR&"/Blog.asp?BlogUserName="&Rs("UserName")&"&menu=ShowBlog&BlogID="&Rs("ID")&">★ "&Left(Rs("Subject"),15)&"</a><br>"<BR>Rs.MoveNext<BR>Loop<BR>Rs.Close<BR>%><BR><br></FONT></P><P><FONT color=#ff0000>●调用论坛公告:<BR><br><BR><%<BR>Sql="Select top 5 * From Order By ID Desc"<BR>Set Rs=Conn.ExeCute(Sql)<BR>Do While Not Rs.Eof<BR>Response.write "<a href="&BBSDIR&"/Affiche.asp?ID="&Rs("ID")&">★ "&Left(Rs("title"),15)&"</a><br>"<BR>Rs.MoveNext<BR>Loop<BR>Rs.Close<BR>%><BR><br></FONT></P><P><FONT color=#ff0000>●调用论坛统计:(适用于7.0)<BR><br><BR><%<BR>Sql="Select * From "<BR>Set Rs=Conn.ExeCute(Sql)<BR>Response.write "<font color=0000FF>★会员总数:"&Rs("TotalUsers")&"</font><br>"<BR>Response.write "<font color=0000FF>★主题总数:"&Rs("TotalTopics")&"</font><br>"<BR>Response.write "<font color=0000FF>★帖子总数:"&Rs("TotalPosts")&"</font><br>"<BR>Response.write "<font color=0000FF>★今日帖数:"&Rs("DaysPosts")&"</font><br>"<BR>Response.write "<font color=0000FF>★新进会员:"&Rs("NewUsers")&"</font><br>"<BR>Rs.Close<BR>%><BR><br></FONT></P><P><FONT color=#ff0000>●调用论坛统计:(适用于6.0)<BR><br><BR><%<BR>Sql="Select * From "<BR>Set Rs=Conn.ExeCute(Sql)<BR>Response.write "<font color=0000FF>★会员总数:"&Rs("TotalUser")&"</font><br>"<BR>Response.write "<font color=0000FF>★主题总数:"&Rs("TotalThread")&"</font><br>"<BR>Response.write "<font color=0000FF>★帖子总数:"&Rs("TotalPost")&"</font><br>"<BR>Response.write "<font color=0000FF>★今日帖数:"&Rs("TodayPost")&"</font><br>"<BR>Response.write "<font color=0000FF>★新进会员:"&Rs("NewUser")&"</font><br>"<BR>Rs.Close<BR>%><BR><br></FONT></P><P><FONT color=#ff0000><%<BR>'撤除连接:<BR>Set Rs=Nothing<BR>Set Conn=Nothing<BR>%></FONT></P><P></body><BR></html></P>
页:
[1]