<% @ Language=VBScript %> <% Option Explicit %> <% 'Set the response buffer to true as we maybe redirecting and setting a cookie Response.Buffer = True 'Make sure this page is not cached Response.Expires = -1 Response.ExpiresAbsolute = Now() - 2 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "No-Store" 'Dimension variables Dim rsCategory 'Holds the categories for the forums Dim rsForum 'Holds the Recordset for the forum details Dim intForumID 'Holds the forum ID number Dim strCategory 'Holds the category name Dim intCatID 'Holds the id for the category Dim strForumName 'Holds the forum name Dim strForumDiscription 'Holds the forum description Dim strForumPassword 'Holds the forum password if there is one Dim strModeratorsList 'Holds a list of moderators for the forum Dim dtmForumStartDate 'Holds the forum start date Dim lngNumberOfTopics 'Holds the number of topics in a forum Dim lngNumberOfPosts 'Holds the number of Posts in the forum Dim lngTotalNumberOfTopics 'Holds the total number of topics in a forum Dim lngTotalNumberOfPosts 'Holds the total number of Posts in the forum Dim intNumberofForums 'Holds the number of forums Dim lngLastEntryMeassgeID 'Holds the message ID of the last entry Dim lngLastEntryTopicID 'Holds the topic ID of the last entry Dim dtmLastEntryDate 'Holds the date of the last entry to the forum Dim strLastEntryUser 'Holds the the username of the user who made the last entry Dim lngLastEntryUserID 'Holds the ID number of the last user to make and entry Dim dtmLastEntryDateAllForums 'Holds the date of the last entry to all fourms Dim strLastEntryUserAllForums 'Holds the the username of the user who made the last entry to all forums Dim lngLastEntryUserIDAllForums 'Holds the ID number of the last user to make and entry to all forums Dim blnForumLocked 'Set to true if the forum is locked Dim intForumColourNumber 'Holds the number to calculate the table row colour Dim intForumReadRights 'Holds the interger number to calculate if the user has read rights on the forum Dim intForumPostRights 'Holds the interger valuse to calculate if the suer can poist in the forum Dim intForumReplyRights 'Holds the interger value to calculate if the user can reply to a post Dim blnHideForum 'Set to true if this is a hidden forum Dim intCatShow 'Holds the ID number of the category to show if only showing one category Dim intActiveUsers 'Holds the number of active users Dim intActiveGuests 'Holds the number of active guests Dim intActiveMembers 'Holds the number of logged in active members Dim strMembersOnline 'Holds the names of the members online 'Initialise variables lngTotalNumberOfTopics = 0 lngTotalNumberOfPosts = 0 intNumberofForums = 0 intForumColourNumber = 0 intActiveMembers = 0 intActiveGuests = 0 intActiveUsers = 0 'Read in the category to show If Request.QueryString("C") Then intCatShow = CInt(Request.QueryString("C")) Else intCatShow = 0 End If 'Craete a recordset to get the forum details Set rsCategory = Server.CreateObject("ADODB.Recordset") 'Read the various categories from the database 'Initalise the strSQL variable with an SQL statement to query the database If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "CategoryAll" Else strSQL = "SELECT " & strDbTable & "Category.Cat_name, " & strDbTable & "Category.Cat_ID FROM " & strDbTable & "Category ORDER BY " & strDbTable & "Category.Cat_order ASC;" End If 'Query the database rsCategory.Open strSQL, adoCon Response.Write "" Response.Write strMainForumName Response.Write "" %> <% Response.Write(" ") Response.Write(" ") Response.Write " ") 'If the user has not logged in (guest user ID = 2) then show them a quick login form If lngLoggedInUserID = 2 Then Response.Write( " ") End If Response.Write( "
" 'Display main page link if in a category view If intCatShow <> 0 Then Response.Write("
 " Response.Write strMainForumName Response.Write "

" END IF Response.Write( "
") If blnLongSecurityCode Then Response.Write(strTxtLogin) Else Response.Write(strTxtQuickLogin) Response.Write " " If blnLongSecurityCode = false Then Response.Write( " ") Response.Write ("
") Response.Write ("" 'Check there are categories to display If rsCategory.EOF Then 'If there are no categories to display then display the appropriate error message Response.Write ( "") '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") 'Loop round to read in all the categories in the database Do While NOT rsCategory.EOF 'Get the category name from the database strCategory = rsCategory("Cat_name") intCatID = CInt(rsCategory("Cat_ID")) 'Display the category name Response.Write "" 'If there this is the cat to show then show it If intCatShow = intCatID OR intCatShow = 0 Then 'Read the various forums from the database 'Initalise the strSQL variable with an SQL statement to query the database If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "ForumsAllWhereCatIs @intCatID = " & intCatID Else strSQL = "SELECT " & strDbTable & "Forum.* FROM " & strDbTable & "Forum WHERE " & strDbTable & "Forum.Cat_ID = " & intCatID & " ORDER BY " & strDbTable & "Forum.Forum_Order ASC;" End If '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 "" 'Else there the are forum's to write the HTML to display it the forum names and a discription Else 'Loop round to read in all the forums in the database Do While NOT rsForum.EOF 'Initialise variables lngLastEntryTopicID = 0 strModeratorsList = "" 'Read in forum details from the database intForumID = CInt(rsForum("Forum_ID")) strForumName = rsForum("Forum_name") strForumDiscription = rsForum("Forum_description") dtmForumStartDate = CDate(rsForum("Date_Started")) strForumPassword = rsForum("Password") lngNumberOfPosts = CLng(rsForum("No_of_posts")) lngNumberOfTopics = CLng(rsForum("No_of_topics")) blnForumLocked = CBool(rsForum("Locked")) intForumReadRights = CInt(rsForum("Read")) intForumPostRights = CInt(rsForum("Post")) intForumReplyRights = CInt(rsForum("Reply_posts")) blnHideForum = CBool(rsForum("Hide")) 'Call the function to check the forum permissions Call forumPermisisons(intForumID, intGroupID, intForumReadRights, intForumPostRights, intForumReplyRights, 0, 0, 0, 0, 0, 0, 0) 'Add all the posts and topics together to get the total number for the stats at the bottom of the page lngTotalNumberOfPosts = lngTotalNumberOfPosts + lngNumberOfPosts lngTotalNumberOfTopics = lngTotalNumberOfTopics + lngNumberOfTopics 'If this forum is to be hidden and but the user is allowed access to it set the hidden boolen back to false If blnHideForum = True AND blnRead = True Then blnHideForum = False 'NEW to hide the Multilingual Lounge IF intForumID=5 THEN blnHideForum= True 'If the forum is to be hidden then don't show it If blnHideForum = False Then 'Get the row number intForumColourNumber = intForumColourNumber + 1 'Initilaise variables for the information required for each forum dtmLastEntryDate = dtmForumStartDate strLastEntryUser = strTxtForumAdministrator lngLastEntryUserID = 1 'Get the List of Group Moderators for the Forum If blnShowMod Then 'Initalise the strSQL variable with an SQL statement to query the database to get the moderators for this forum If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "ModeratorGroup @intForumID = " & intForumID Else strSQL = "SELECT " & strDbTable & "Group.Group_ID, " & strDbTable & "Group.Name " strSQL = strSQL & "FROM " & strDbTable & "Group, " & strDbTable & "Permissions " strSQL = strSQL & "WHERE " & strDbTable & "Group.Group_ID = " & strDbTable & "Permissions.Group_ID AND " & strDbTable & "Permissions.Moderate = True AND " & strDbTable & "Permissions.Forum_ID = " & intForumID & ";" End If 'Query the database rsCommon.Open strSQL, adoCon 'Initlaise the Moderators List varible if there are records returned for the forum If NOT rsCommon.EOF Then strModeratorsList = "
" & strTxtModerators & ":" 'Loop round to build a list of moderators, if there are any Do While NOT rsCommon.EOF 'Place the moderators username into the string strModeratorsList = strModeratorsList & " " & rsCommon("Name") & "" 'Move to the next record rsCommon.MoveNext Loop 'Close the recordset rsCommon.Close 'Initalise the strSQL variable with an SQL statement to query the database to get the moderators for this forum If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "Moderators @intForumID = " & intForumID Else strSQL = "SELECT " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Username " strSQL = strSQL & "FROM " & strDbTable & "Permissions, " & strDbTable & "Author " strSQL = strSQL & "WHERE " & strDbTable & "Author.Author_ID = " & strDbTable & "Permissions.Author_ID AND " & strDbTable & "Permissions.Moderate = True AND " & strDbTable & "Permissions.Forum_ID = " & intForumID & ";" End If 'Query the database rsCommon.Open strSQL, adoCon 'Initlaise the Moderators List varible if there are records returned for the forum If NOT rsCommon.EOF AND strModeratorsList = "" Then strModeratorsList = "
" & strTxtModerators & ":" 'Loop round to build a list of moderators, if there are any Do While NOT rsCommon.EOF 'Place the moderators username into the string strModeratorsList = strModeratorsList & " " & rsCommon("Username") & "" 'Move to the next record rsCommon.MoveNext Loop 'Close the recordset rsCommon.Close End If 'Initalise the strSQL variable with an SQL statement to query the database for the date of the last entry and the author for the thread If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "LastForumPostEntry @intForumID = " & intForumID Else strSQL = "SELECT Top 1 " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID, " & strDbTable & "Thread.Topic_ID, " & strDbTable & "Thread.Thread_ID, " & strDbTable & "Thread.Message_date " strSQL = strSQL & "FROM " & strDbTable & "Author, " & strDbTable & "Thread " strSQL = strSQL & "WHERE " & strDbTable & "Author.Author_ID = " & strDbTable & "Thread.Author_ID AND " & strDbTable & "Thread.Topic_ID IN " strSQL = strSQL & " (SELECT TOP 1 " & strDbTable & "Topic.Topic_ID " strSQL = strSQL & " FROM " & strDbTable & "Topic " strSQL = strSQL & " WHERE " & strDbTable & "Topic.Forum_ID = " & intForumID & " " strSQL = strSQL & " ORDER BY " & strDbTable & "Topic.Last_entry_date DESC) " strSQL = strSQL & "ORDER BY " & strDbTable & "Thread.Message_date DESC;" End If 'Query the database rsCommon.Open strSQL, adoCon 'If there are threads for topic then read in the date and author of the last entry If NOT rsCommon.EOF Then 'Read in the deatils from the recorset of the last post details lngLastEntryMeassgeID = CLng(rsCommon("Thread_ID")) lngLastEntryTopicID = CLng(rsCommon("Topic_ID")) dtmLastEntryDate = CDate(rsCommon("Message_date")) strLastEntryUser = rsCommon("Username") lngLastEntryUserID = CLng(rsCommon("Author_ID")) End If 'Reset variables rsCommon.Close 'Calculate the last forum entry across all forums for the statistics at the bottom of the forum If dtmLastEntryDateAllForums < dtmLastEntryDate Then dtmLastEntryDateAllForums = dtmLastEntryDate strLastEntryUserAllForums = strLastEntryUser lngLastEntryUserIDAllForums = lngLastEntryUserID End If 'Write the HTML of the forum descriptions and hyperlinks to the forums Response.Write("") End If 'Count the number of forums intNumberofForums = intNumberofForums + 1 'Move to the next database record rsForum.MoveNext 'Loop back round for next forum Loop End If 'Close recordsets rsForum.Close End If 'Move to the next database record rsCategory.MoveNext 'Loop back round for next category Loop End If 'Release server variables rsCategory.Close Set rsCategory = Nothing Set rsForum = Nothing response.write "
 ") Response.Write strTxtForum Response.Write ("") Response.Write strTxtTopics Response.Write ("") Response.Write strTxtPosts Response.Write ("") Response.Write strTxtLastPost Response.Write "
" & strTxtNoForums & "
" & strCategory & "
" & strTxtNoForums & "
" 'If the user has no access to a forum diplay a no access icon If blnRead = False AND blnModerator = False AND blnAdmin = False Then Response.Write " 
							Response.Write chr(34)
							Response.Write strTxtNoAccess 
							Response.Write chr(34)
							Response.Write " 'If the forum requires a password diplay the password icon ElseIf strForumPassword <> "" Then Response.Write " 
							  Response.Write chr(34)
							  Response.Write strTxtPasswordRequired 
							  Response.Write chr(34)
							  Response.Write " 'If the forum is read only and has new posts show the locked new posts icon ElseIf CDate(Session("dtmLastVisit")) < dtmLastEntryDate AND (blnForumLocked = True) AND blnAdmin = False AND blnModerator = False Then Response.Write " 
							Response.Write chr(34)
							Response.Write strTxtReadOnlyNewReplies
							Response.Write chr(34) 
							Response.Write " 'If the forum is read only show the locked new posts icon ElseIf blnForumLocked Then Response.Write " 
							 Response.Write chr(34) 
							 Response.Write strTxtReadOnly 
							 Response.Write chr(34)
							 Response.Write " 'If the forum has new posts show the new posts icon ElseIf CDate(Session("dtmLastVisit")) < dtmLastEntryDate Then Response.Write " " 'If the forum is open but with no new replies Else Response.Write " " End If Response.Write( " " 'If this is the forum admin then let them have access to the forum admin pop up window If blnAdmin Then Response.Write(" ") Response.Write " " Response.Write strForumName Response.Write "
" Response.Write strForumDiscription Response.Write strModeratorsList Response.Write "
") Response.Write lngNumberOfTopics Response.Write ("") Response.Write lngNumberOfPosts Response.Write (" ") Response.Write DateFormat(dtmLastEntryDate, saryDateTimeData) Response.Write " " Response.Write strTxtAt Response.Write " " Response.Write TimeFormat(dtmLastEntryDate, saryDateTimeData) Response.Write "
" Response.Write strTxtBy Response.Write " " Response.Write strLastEntryUser Response.Write "

" response.write "" 'SHOW who was online today only if logged in If intGroupID <> 2 Then RESPONSE.WRITE "" END IF Response.Write "
" response.write strTxtForumStatistics response.write "
" Response.Write " " Response.Write strTxtOurUserHavePosted Response.Write " " Response.Write lngTotalNumberOfPosts Response.Write " " Response.Write strTxtPostsIn Response.Write " " Response.Write lngTotalNumberOfTopics Response.Write " " Response.Write strTxtTopicsIn Response.Write " " Response.Write intNumberofForums Response.Write " " Response.Write strTxtForums Response.Write "
" Response.Write strTxtLastPostOn Response.Write " " Response.Write DateFormat(dtmLastEntryDateAllForums, saryDateTimeData) Response.Write " " Response.Write strTxtAt Response.Write " " Response.Write TimeFormat(dtmLastEntryDateAllForums, saryDateTimeData) Response.Write " " Response.Write strTxtBy Response.Write " " Response.Write strLastEntryUserAllForums Response.Write "" 'Get the latest forum posts 'Cursor type to one to count rsCommon.CursorType = 1 'Get the last signed up user 'Initalise the strSQL variable with an SQL statement to query the database If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "AuthorDesc" Else strSQL = "SELECT " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID " strSQL = strSQL & "FROM " & strDbTable & "Author " strSQL = strSQL & "ORDER BY " & strDbTable & "Author.Author_ID DESC;" End If 'Query the database rsCommon.Open strSQL, adoCon 'Display some statistics for the members If NOT rsCommon.EOF Then Response.Write "
" Response.Write strTxtWeHave Response.Write " " Response.Write rsCommon.RecordCount Response.Write " " Response.Write strTxtForumMembers Response.Write "
" Response.Write strTxtTheNewestForumMember Response.Write " " Response.Write rsCommon("Username") Response.Write "" End If 'Close the recordset rsCommon.Close 'Get the number of active users if enabled If blnActiveUsers Then 'Get the active users online For intArrayPass = 1 To UBound(saryActiveUsers, 2) 'If this is a guest user then increment the number of active guests veriable If saryActiveUsers(1, intArrayPass) = 2 Then intActiveGuests = intActiveGuests + 1 'Else add the name of the members name of the active users to the members online string ElseIf CBool(saryActiveUsers(7, intArrayPass)) = false Then If strMembersOnline <> "" Then strMembersOnline = strMembersOnline & ", " strMembersOnline = strMembersOnline & "" & saryActiveUsers(2, intArrayPass) & "" End If Next 'Calculate the number of members online and total people online intActiveUsers = UBound(saryActiveUsers, 2) intActiveMembers = intActiveUsers - intActiveGuests Response.Write "
" Response.Write strTxtInTotalThereAre Response.Write " " Response.Write intActiveUsers Response.Write " " Response.Write strTxtActiveUsers Response.Write " " Response.Write strTxtOnLine Response.Write ", " Response.Write intActiveGuests Response.Write " " Response.Write strTxtGuestsAnd Response.Write " " Response.Write intActiveMembers Response.Write " " Response.Write strTxtMembers If strMembersOnline <> "" Then Response.Write "
" Response.Write strTxtMembers Response.Write " " Response.Write strTxtOnLine Response.Write ": " Response.Write strMembersOnline END IF End If Response.Write "
" 'NEW MOD FOR USERS WHO LOGGED IN TODAY Dim MyCheck, intDay, intMonth, intYear, dtmDate, dtmTempDate dtmDate = now() If strTimeOffSet = "+" Then dtmTempDate = DateAdd("h", + intTimeOffSet, dtmDate) ElseIf strTimeOffSet = "-" Then dtmTempDate = DateAdd("h", - intTimeOffSet, dtmDate) End If 'Seprate the date into differnet strings intDay = CInt(Day(dtmTempDate)) intMonth = CInt(Month(dtmTempDate)) intYear = CInt(Year(dtmTempDate)) MyCheck = False strSQL = "SELECT Username, Author_ID, Group_ID, Last_visit " strSQL = strSQL & ",DateAdd(hh, " & strTimeOffSet & intTimeOffSet & ", Last_visit) AS FFGG " strSQL = strSQL & "FROM " & strDbTable & "Author " strSQL = strSQL & "where day(DateAdd(hh, " & strTimeOffSet & intTimeOffSet & ", Last_visit)) = " & intDay & " and month(DateAdd(hh, " & strTimeOffSet & intTimeOffSet & ", Last_visit)) = " & intMonth & " and year(DateAdd(hh, " & strTimeOffSet & intTimeOffSet & ", Last_visit)) = " & intYear & " " strSQL = strSQL & "ORDER BY FFGG DESC;" rsCommon.Open strSQL, adoCon Response.Write "" & rsCommon.RecordCount & " members have logged in today: " Do Until rsCommon.eof If MyCheck = True then Response.Write ", " Else MyCheck = True End If Response.Write "" Response.Write rsCommon("Username") Response.Write "" rsCommon.MoveNext Loop RESPONSE.WRITE "
" 'Reset Server Objects Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing Response.Write "

" 'Response.Write "
" Response.Write strTxtCookies 'Response.Write "

" Response.Write "
" Response.Write strTxtMarkAllPostsAsRead Response.Write "" 'Display the process time If blnShowProcessTime Then Response.Write "
" Response.Write strTxtThisPageWasGeneratedIn Response.Write " " Response.Write FormatNumber(Timer() - dblStartTime, 4) Response.Write " " Response.Write strTxtSeconds Response.Write "
" END IF Response.Write "
" %>