📄 default.asp
字号:
<!--#INCLUDE FILE="config.inc" -->
<%
'## Default.asp
'## Open DataBase Connection
'## (Change to include file soon!)
set my_conn= Server.CreateObject("ADODB.Connection")
my_Conn.Open ConnString
'## Get Totals
set rs1 = Server.CreateObject("ADODB.Recordset")
strSQL = "Select * from Totals"
rs1.open strSQL, my_conn
Users = rs1("U_Count")
Posts = rs1("P_Count")
rs1.Close
set rs1 = nothing
'## Get all Forums From DB
strSql = "SELECT * FROM Category"
set rs = my_conn.Execute (StrSql)
'## Do some Cookie bits to see when last here
session("last_here_date") = Request.Cookies("date")
Response.Cookies("Date") = now()
Response.Cookies("Date").Expires = dateadd("d",365,now())
' if never been here before, set last_here_date to -10 days
if Session("last_here_date") = "" then
Session("last_here_date") = dateadd("d",-10,now())
End if
'## Function to display new icon
Function isNew(dt)
if datediff("s", session("last_here_date"), dt) > 1 then
isNew = "<font face='" & DefaultFontFace & "' color='" & NewFontColor & "' size='1'>New"
Else
isNew = " "
End If
End Function
%>
<!--#INCLUDE FILE="top.inc" -->
<table width="100%" border =0><tr><td><font face="<% =DefaultFontFace %>" size="1">
You last Visited - <%= session("last_here_date")%>
</td><td align=right><font face="<% =DefaultFontFace %>" size="1">Total Posts : <%= Posts %> , Total Users : <%= Users %> </font></td></tr>
</table>
<div align="center"><center>
<table border="0" width="95%" cellspacing="2" cellpadding="0">
<tr>
<td align="center" bgcolor="<% =HeadCellColor %>"><strong> </td>
<td align="center" bgcolor="<% =HeadCellColor %>"><strong>
<font face="<% =DefaultFontFace %>" size="2" color="<% =HeadFontColor %>">Forum</font></strong></td>
<td align="center" bgcolor="<% =HeadCellColor %>"><strong>
<font face="<% =DefaultFontFace %>" size="2" color="<% =HeadFontColor %>">Posts</font></strong></td>
<td align="center" bgcolor="<% =HeadCellColor %>"><strong>
<font face="<% =DefaultFontFace %>" size="2" color="<% =HeadFontColor %>">Last Post</font></strong></td>
<td align="center" bgcolor="<% =HeadCellColor %>"><strong>
<font face="<% =DefaultFontFace %>" size="2" color="<% =HeadFontColor %>">Moderator</font></strong></td>
</tr>
<%
If rs.Eof or rs.Bof then ' No categories found in DB
Response.Write "<tr><td collspan=5>No Forums Found</td></tr>"
Else
do until rs.eof '## Grab the Categories.
'## Display Category
Response.Write "<tr><td colspan=5 bgcolor='" & CategoryCellColor & "'><font face='" & DefaultFontFace & "' size='2' color='" & CategoryFontColor & "' size+1> <strong>"& rs("cat_name") & " </strong></font></td></tr>"
'## Build SQL to get forums via category
strSql = "SELECT Forum.Forum_ID, Forum.F_Name, Forum.F_Description, Forum.F_Cat, Forum.F_Count, Forum.F_Last_Post, Forum.F_Moderator, Members.M_Name "
strSql = strSql & "FROM Members INNER JOIN Forum ON Members.Member_id = Forum.F_Moderator "
strSql = strSql & "where Forum.F_Cat = " & rs("cat_id")
set rsForum = my_conn.Execute (StrSql)
if rsForum.eof or rsForum.bof then
Response.Write "<tr><td collspan=5> </td></tr>"
else
do until rsForum.Eof '## Display Forum
Response.Write "<tr>" & vbcrlf
Response.Write "<td bgcolor='" & ForumCellColor & "'>" & isNew(rsForum("F_Last_Post")) & "</td>"& vbcrlf
Response.Write "<td bgcolor='" & ForumCellColor & "'><font face='" & DefaultFontFace & "' size=2><a href='forum.asp?forum_id=" & rsForum("Forum_ID") & "&forum_title=" & server.URLEncode(rsForum("F_name")) & "'>"
Response.Write rsForum("F_name") & "</a><br>" & vbcrlf
Response.Write "<font color='" & ForumFontColor & "' face='" & DefaultFontFace & "' size='2'>" & rsForum("F_Description") & "</font></td>" & vbcrlf
Response.Write "<td bgcolor='" & ForumCellColor & "' align='center' valign='top' ><font face='" & DefaultFontFace & "' color='" & ForumFontColor & "' size='2'>" & rsForum("F_Count") & "</font></td>" & vbcrlf
Response.Write "<td bgcolor='" & ForumCellColor & "' align='center' valign='top'><font face='" & DefaultFontFace & "' color='" & ForumFontColor & "' size='2'>" & rsForum("F_Last_Post") & "</font></td>" & vbcrlf
Response.Write "<td bgcolor='" & ForumCellColor & "' valign='top'><font face='" & DefaultFontFace & "' color='" & ForumFontColor & "' size='2'>" & rsForum("M_Name") & "</font></td>"
Response.Write "</tr>" & vbcrlf
rsForum.movenext
loop
End If
rs.MoveNext
loop
End If
%>
</table>
<p align="center"> <font face="<% =DefaultFontFace %>" size="3"><a href="default.asp">Show All Forums</a></p>
</body></html>
<%
my_conn.Close
set my_conn = nothing
set rs = nothing
set rsForum = nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -