% @ Language=VBScript %>
<% Option Explicit %>
<%
'Set the response buffer to true
Response.Buffer = True
%>
FORUM
|
LOCK
|
DELETE
|
<%
'Dimension variables
Dim rsForum 'Holds the Recordset for the forum details
Dim strCategory 'Holds the categories
Dim intCatID 'Holds the category ID number
Dim intForumID 'Holds the forum ID number
Dim strForumName 'Holds the forum name
Dim strForumDiscription 'Holds the forum description
Dim blnForumLocked 'Set to true if the forum is locked
Dim intLoop 'Holds the number of times round in the Loop Counter
Dim intNumOfForums 'Holds the number of forums
Dim intForumOrder 'Holds the order number of the forum
Dim intNumOfCategories 'Holds the number of categories
Dim intCatOrder 'Holds the order number of the category
'Read the various categories from the database
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT " & strDbTable & "Category.* FROM " & strDbTable & "Category ORDER BY " & strDbTable & "Category.Cat_order ASC;"
'Set the curson type to 1 so we can count the number of records returned
rsCommon.CursorType = 1
'Query the database
rsCommon.Open strSQL, adoCon
'Check there are categories to display
If rsCommon.EOF Then
'If there are no categories to display then display the appropriate error message
'Response.Write vbCrLf & "There are no Categories to display. Click here to create a Forum Category | "
Response.Write vbCrLf & " | "
Response.Write vbCrLf & "There are no Categories to display. Click here to create a Forum Category | "
'Else there the are categories so write the HTML to display categories and the forum names and a discription
Else
'Create a recordset to get the forum details
Set rsForum = Server.CreateObject("ADODB.Recordset")
'Get the number of categories
intNumOfCategories = rsCommon.RecordCount
'Loop round to read in all the categories in the database
Do While NOT rsCommon.EOF
'Get the category name from the database
strCategory = rsCommon("Cat_name")
intCatID = CInt(rsCommon("Cat_ID"))
intCatOrder = CInt(rsCommon("Cat_order"))
'Display the category name
%>
<% = ucase(strCategory) %>
|
|
<%
'Read the various forums from the database
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT " & strDbTable & "Forum.* FROM " & strDbTable & "Forum WHERE " & strDbTable & "Forum.Cat_ID = " & intCatID & " ORDER BY " & strDbTable & "Forum.Forum_Order ASC;"
rsForum.CursorType = 1
'Query the database
rsForum.Open strSQL, adoCon
'Check there are forum's to display
If rsForum.EOF Then
'If there are no forum's to display then display the appropriate error message
Response.Write vbCrLf & " | "
Response.Write vbCrLf & "There are no Forum's to display. Click here to create a Forum | "
'Else there the are forum's to write the HTML to display it the forum names and a discription
Else
'Get the number of categories
intNumOfForums = rsForum.RecordCount
'Loop round to read in all the forums in the database
Do While NOT rsForum.EOF
'Read in forum details from the database
intForumID = CInt(rsForum("Forum_ID"))
strForumName = rsForum("Forum_name")
strForumDiscription = rsForum("Forum_description")
intForumOrder = CInt(rsForum("Forum_order"))
blnForumLocked = CBool(rsForum("Locked"))
'Write the HTML of the forum descriptions and hyperlinks to the forums
%>
|
<% = strForumName %>
<% = strForumDiscription %>
|
<%
'If the forum is locked and the user is admin let them unlock it
If blnForumLocked = True Then
Response.Write (" ")
'If the forum is not lovked and this is the admin then let them lock it
ElseIf blnForumLocked = False Then
Response.Write (" ")
End If
%>
|
|
<%
'Move to the next database record
rsForum.MoveNext
'Loop back round for next forum
Loop
End If
'Close recordsets
rsForum.Close
'Move to the next database record
rsCommon.MoveNext
'Loop back round for next category
Loop
End If
Set rsForum = Nothing
Set rsCommon = Nothing
adoCon.Close
Set adoCon = Nothing
%>