<% @ Language=VBScript %> <% Option Explicit %> [an error occurred while processing this directive] <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide - Web Wiz Forums '** '** Copyright 2001-2004 Bruce Corkhill All Rights Reserved. '** '** This program is free software; you can modify (at your own risk) any part of it '** under the terms of the License that accompanies this software and use it both '** privately and commercially. '** '** All copyright notices must remain in tacked in the scripts and the '** outputted HTML. '** '** You may use parts of this program in your own private work, but you may NOT '** redistribute, repackage, or sell the whole or any part of this program even '** if it is modified or reverse engineered in whole or in part without express '** permission from the author. '** '** You may not pass the whole or any part of this application off as your own work. '** '** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place '** and must remain visible when the pages are viewed unless permission is first granted '** by the copyright holder. '** '** This program is distributed in the hope that it will be useful, '** but WITHOUT ANY WARRANTY; without even the implied warranty of '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER '** WARRANTIES WHETHER EXPRESSED OR IMPLIED. '** '** You should have received a copy of the License along with this program; '** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom. '** '** '** No official support is available for this program but you may post support questions at: - '** http://www.webwizguide.info/forum '** '** Support questions are NOT answered by e-mail ever! '** '** For correspondence or non support questions contact: - '** info@webwizguide.info '** '** or at: - '** '** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom '** '**************************************************************************************** 'Set the timeout of the forum Server.ScriptTimeout = 90 Session.Timeout = 20 'Set the date time format to your own if you are getting a CDATE error 'Session.LCID = 1033 Dim adoCon 'Database Connection Variable Object Dim strCon 'Holds the string to connect to the db Dim rsCommon 'Holds the configuartion recordset Dim strSQL 'Holds the SQL query for the database Dim lngLoggedInUserID 'Holds a logged in users ID number Dim strLoggedInUsername 'Holds a logged in users username Dim intGroupID 'Holds the group ID number the member is a group of Dim strWebsiteName 'Holds the website name Dim strMainForumName 'Holds the forum name Dim strForumPath 'Holds the virtual path to the forum Dim strForumEmailAddress 'Holds the forum e-mail address Dim blnTextLinks 'Set to true if you want text links instead of the powered by logo Dim blnRTEEditor 'Set to true if the Rich Text Editor(RTE) is enabled Dim blnEmail 'Boolean set to true if e-mail is on Dim strMailComponent 'Email coponent the forum useses Dim strOutgoingMailServer 'Forums incomming mail server Dim strLoggedInUserCode 'Holds the user code of the user Dim blnLCode 'set to true Dim blnAdmin 'set to true if the user is a forum admininstrator (Group ID 1) Dim blnModerator 'Set to true if the user is a forum moderator Dim blnGuest 'set to true for the Guest account (Group ID 2) Dim blnActiveMember 'Set to false if the member is no longer allowed to post messages on the forum Dim blnLoggedInUserEmail 'Set to true if the user has entered there e-mail Dim blnLoggedInUserSignature 'set to true if the user has enetered a signature Dim intTopicPerPage 'Holds the number of topics to show on each page Dim strTitleImage 'Holds the path and name for the title image for the forum Dim blnEmoticons 'Set to true if emoticons are turned on Dim strDatabaseDateFunction 'Holds a different date function for Access or SQL server Dim strDatabaseType 'Holds the type of database used Dim blnGuestPost 'Set to true if guests can post Dim blnAvatar 'Set to true if the forum can use avatars Dim blnEmailActivation 'Set to true if the e-mail activation is turned on Dim blnSendPost 'Set to true if post is sent with e-mail notification Dim intNumHotViews 'Holds the number of how many views a topic has before it becomes a hot topic Dim intNumHotReplies 'Holds the number of replies before a topic becomes a hot topic Dim blnPrivateMessages 'Set to true if private messages are allowed Dim intNumPrivateMessages 'Holds the number of private messages allowed by each user Dim intThreadsPerPage 'Holds the number of threads shown per page Dim strDbPathAndName 'Holds the path and name of the database Dim intSpamTimeLimitSeconds 'Holds the number of secounds between posts Dim intSpamTimeLimitMinutes 'Holds the number of minutes the user can post five posts in Dim strDateFormat 'Holds the users date format Dim strTimeOffSet 'Holds the users time offset in + or - Dim intTimeOffSet 'Holds the users time offset Dim blnReplyNotify 'Set to true if the user wants to be notified of replies to posts Dim blnAttachSignature 'Set to true if the user always wants there signature attached Dim blnWYSIWYGEditor 'Set to true if the user wants to use the IE WYSIWYG post editor Dim intMaxPollChoices 'Holds the maximum allowed number of poll choices Dim blnEmailMessenger 'Set to true if the email system is on Dim blnActiveUsers 'Set to true if active users is enabled Dim blnForumClosed 'Set to true of the forum is cloded for maintence Dim blnShowEditUser 'Set to true if we are to show the username and time a post is edited Dim blnShowProcessTime 'Set to true if we are to show how long the page took to be processed on the server Dim dblStartTime 'Holds the start time for the page process Dim blnClosedForumPage 'Set to true if we are looking at the closed forum page Dim blnFlashFiles 'Set to true if Flash support is enabled Dim strWebsiteURL 'Holds the URL to the sites homepage Dim blnShowMod 'Set to true if mod groups are shown on the main forum page Dim blnAvatarUploadEnabled 'Set to true if avatars are enabled Dim blnRegistrationSuspeneded 'Set to true if new registrations are suspended Dim strLoggedInUserEmail 'Holds the logged in users email address Dim strImageTypes 'Holds the types of images allowed in the forum Dim blnLongRegForm 'Set to true if the reg form is to be the long version Dim blnLongSecurityCode 'Set to true if the security code feature is required when logging in Dim blnUseApplicationVariables 'Set to true if application varibles are used 'These are used for forum permissions Dim blnRead Dim blnPost Dim blnReply Dim blnEdit Dim blnDelete Dim blnPriority Dim blnPollCreate Dim blnVote Dim blnAttachments Dim blnImageUpload 'Initialise variables Const strVersion = "7.7" Const strRTEversion = "1.2c" lngLoggedInUserID = 0 strLoggedInUsername = strTxtGuest blnActiveMember = true blnLoggedInUserEmail = false blnLoggedInUserSignature = false intGroupID = 2 lngLoggedInUserID = 2 blnAdmin = false blnModerator = false blnGuest = true intTimeOffSet = 0 strTimeOffSet = "+" blnWYSIWYGEditor = true blnLongRegForm = true blnLongSecurityCode = false 'Database Type strDatabaseType = "Access" 'strDatabaseType = "SQLServer" 'Set up the database table name prefix and stored procedure prefix '(This is useful if you are running multiple forums from one database) ' - make sure you also change this in the msSQL_server_setup.asp file if setting up an ms SQL server database) Const strDbTable = "tbl" Const strDbProc = "wwfSp" 'Set up the forum cookie name '(This is useful if you run multiple copies of Web Wiz Forums on the same site so that cookies don't interfer with each other) Const strCookieName = "WWF" 'Set if application variables are used for forum configuration 'This will make your forum run faster as there are less hits on the database, but if you are using free web hosting or 'are on a server where you share your application oject with others then you will need to set this to false blnUseApplicationVariables = true 'Set Encrypted passwords (ignore unless you don't wish to use Encrypted passwords in your forum) 'This will make your forum unsecure from hackers if you disable this!!!!! 'This can NOT be changed once your forum is in use!!! 'If you do disable Encrypted Passwords - You will also need to directly edit the database to type in the admin password to the Password field in the tblAuthor table at record position 1 also edit both common.asp files to change this variable Const blnEncryptedPasswords = true 'True = Encrypted Passwords Enabled - Flase = Encrypted Passwords Disabled 'Create database connection 'Create a connection odject Set adoCon = Server.CreateObject("ADODB.Connection") 'If this is access set the access driver If strDatabaseType = "Access" Then '--------------------- Set the path and name of the database -------------------------------------------------------------------------------- 'Virtual path to database strDbPathAndName = Server.MapPath("../../../data/si_bb.mdb") 'This is the path of the database from this files location on the server 'Physical path to database 'strDbPathAndName = "" 'Use this if you use the physical server path, eg:- C:\Inetpub\private\wwForum.mdb 'BRINKSTER USERS (Web Wiz Forums only works with free Brinkster accounts, not for the paid accounts) 'Brinkster users remove the ' single quote mark from infront of the line below and replace USERNAME with your Brinkster uersname 'strDbPathAndName = Server.MapPath("/stratins/db/wwForum.mdb") 'PLEASE NOTE: - For extra security it is highly recommended you change the name of the database, wwForum.mdb, to another name and then 'replace the wwForum.mdb found above with the name you changed the forum database to. '--------------------------------------------------------------------------------------------------------------------------------------------- '------------- If you are having problems with the script then try using a diffrent driver or DSN by editing the lines below -------------- 'Generic MS Access Database connection info and driver (if this driver does not work then comment it out and use one of the alternative faster JET OLE DB drivers) 'strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strDbPathAndName 'Alternative drivers faster than the generic one above 'strCon = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & strDbPathAndName 'This one is if you convert the database to Access 97 strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strDbPathAndName 'This one is for Access 2000/2002 'If you wish to use DSN then comment out the driver above and uncomment the line below (DSN is slower than the above drivers) 'strCon = "DSN=DSN_NAME" 'Place the DSN where you see DSN_NAME '--------------------------------------------------------------------------------------------------------------------------------------------- 'The now() function is used in Access for dates strDatabaseDateFunction = "Now()" 'Else set the MS SQL server stuff Else %>[an error occurred while processing this directive]<% 'The GetDate() function is used in SQL Server strDatabaseDateFunction = "GetDate()" End If 'Set the connection string to the database adoCon.connectionstring = strCon 'Set an active connection to the Connection object adoCon.Open 'Intialise the main ADO recordset object Set rsCommon = Server.CreateObject("ADODB.Recordset") 'Read in the Forum configuration If isEmpty(Application("blnConfigurationSet")) OR isNull(Application("blnConfigurationSet")) OR Application("blnConfigurationSet") = false OR blnUseApplicationVariables = false Then 'Initialise the SQL variable with an SQL statement to get the configuration details from the database If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "SelectConfiguration" Else strSQL = "SELECT TOP 1 " & strDbTable & "Configuration.* From " & strDbTable & "Configuration;" End If 'Query the database rsCommon.Open strSQL, adoCon 'If there is config deatils in the recordset then read them in If NOT rsCommon.EOF Then 'read in the configuration details from the recordset strWebsiteName = rsCommon("website_name") strMainForumName = rsCommon("forum_name") strWebsiteURL = rsCommon("website_path") strForumPath = rsCommon("forum_path") strMailComponent = rsCommon("mail_component") strOutgoingMailServer = rsCommon("mail_server") strForumEmailAddress = rsCommon("forum_email_address") blnLCode = CBool(rsCommon("L_Code")) blnEmail = CBool(rsCommon("email_notify")) blnTextLinks = rsCommon("Text_link") blnRTEEditor = CBool(rsCommon("IE_editor")) intTopicPerPage = CInt(rsCommon("Topics_per_page")) strTitleImage = rsCommon("Title_image") blnEmoticons = CBool(rsCommon("Emoticons")) blnAvatar = CBool(rsCommon("Avatar")) blnEmailActivation = CBool(rsCommon("Email_activate")) intNumHotViews = CInt(rsCommon("Hot_views")) intNumHotReplies = CInt(rsCommon("Hot_replies")) blnSendPost = CBool(rsCommon("Email_post")) blnPrivateMessages = CBool(rsCommon("Private_msg")) intNumPrivateMessages = CInt(rsCommon("No_of_priavte_msg")) intThreadsPerPage = CInt(rsCommon("Threads_per_page")) intSpamTimeLimitSeconds = CInt(rsCommon("Spam_seconds")) intSpamTimeLimitMinutes = CInt(rsCommon("Spam_minutes")) intMaxPollChoices = CInt(rsCommon("Vote_choices")) blnEmailMessenger = CBool(rsCommon("Email_sys")) blnActiveUsers = CBool(rsCommon("Active_users")) blnForumClosed = CBool(rsCommon("Forums_closed")) blnShowEditUser = CBool(rsCommon("Show_edit")) blnShowProcessTime = CBool(rsCommon("Process_time")) blnFlashFiles = CBool(rsCommon("Flash")) blnShowMod = CBool(rsCommon("Show_mod")) blnAvatarUploadEnabled = CBool(rsCommon("Upload_avatar")) blnRegistrationSuspeneded = CBool(rsCommon("Reg_closed")) strImageTypes = rsCommon("Upload_img_types") 'If we are using application level variables the configuration into the application level variables If blnUseApplicationVariables Then 'Lock the application so only one user updates it at a time Application.Lock 'read in the configuration details from the recordset Application("strWebsiteName") = strWebsiteName Application("strMainForumName") = strMainForumName Application("strWebsiteURL") = strWebsiteURL Application("strForumPath") = strForumPath Application("strMailComponent") = strMailComponent Application("strIncomingMailServer") = strOutgoingMailServer Application("strForumEmailAddress") = strForumEmailAddress Application("blnLCode") = CBool(blnLCode) Application("blnEmail") = CBool(blnEmail) Application("blnTextLinks") =blnTextLinks Application("blnRTEEditor") = CBool(blnRTEEditor) Application("intTopicPerPage") = CInt(intTopicPerPage) Application("strTitleImage") = strTitleImage Application("blnEmoticons") = CBool(blnEmoticons) Application("blnAvatar") = CBool(blnAvatar) Application("blnEmailActivation") = CBool(blnEmailActivation) Application("intNumHotViews") = CInt(intNumHotViews) Application("intNumHotReplies") = CInt(intNumHotReplies) Application("blnSendPost") = CBool(blnSendPost) Application("blnPrivateMessages") = CBool(blnPrivateMessages) Application("intNumPrivateMessages") = CInt(intNumPrivateMessages) Application("intThreadsPerPage") = CInt(intThreadsPerPage) Application("intSpamTimeLimitSeconds") = CInt(intSpamTimeLimitSeconds) Application("intSpamTimeLimitMinutes") = CInt(intSpamTimeLimitMinutes) Application("intMaxPollChoices") = CInt(intMaxPollChoices) Application("blnEmailMessenger") = CBool(blnEmailMessenger) Application("blnActiveUsers") = CBool(blnActiveUsers) Application("blnForumClosed") = CBool(blnForumClosed) Application("blnShowEditUser") = CBool(blnShowEditUser) Application("blnShowProcessTime") = CBool(blnShowProcessTime) Application("blnFlashFiles") = CBool(blnFlashFiles) Application("blnShowMod") = CBool(blnShowMod) Application("blnAvatarUploadEnabled") = CBool(blnAvatarUploadEnabled) Application("blnRegistrationSuspeneded") = CBool(blnRegistrationSuspeneded) Application("strImageTypes") = strImageTypes 'Set the configuartion set application variable to true Application("blnConfigurationSet") = True 'Unlock the application Application.UnLock End If End If 'Close the recordset rsCommon.Close 'If we are using application level variables for the forum configuration then load in the variables from the application variables. ElseIf blnUseApplicationVariables Then 'read in the configuration details from the application varaibales strWebsiteName = Application("strWebsiteName") strMainForumName = Application("strMainForumName") strWebsiteURL = Application("strWebsiteURL") strForumPath = Application("strForumPath") strMailComponent = Application("strMailComponent") strOutgoingMailServer = Application("strOutgoingMailServer") strForumEmailAddress = Application("strForumEmailAddress") blnLCode = CBool(Application("blnLCode")) blnEmail = CBool(Application("blnEmail")) blnTextLinks = Application("blnTextLinks") blnRTEEditor = CBool(Application("blnRTEEditor")) intTopicPerPage = CInt(Application("intTopicPerPage")) strTitleImage = Application("strTitleImage") blnEmoticons = CBool(Application("blnEmoticons")) blnAvatar = CBool(Application("blnAvatar")) blnEmailActivation = CBool(Application("blnEmailActivation")) intNumHotViews = CInt(Application("intNumHotViews")) intNumHotReplies = CInt(Application("intNumHotReplies")) blnSendPost = CBool(Application("blnSendPost")) blnPrivateMessages = CBool(Application("blnPrivateMessages")) intNumPrivateMessages = CInt(Application("intNumPrivateMessages")) intThreadsPerPage = CInt(Application("intThreadsPerPage")) intSpamTimeLimitSeconds = CInt(Application("intSpamTimeLimitSeconds")) intSpamTimeLimitMinutes = CInt(Application("intSpamTimeLimitMinutes")) intMaxPollChoices = CInt(Application("intMaxPollChoices")) blnEmailMessenger = CBool(Application("blnEmailMessenger")) blnActiveUsers = CBool(Application("blnActiveUsers")) blnForumClosed = CBool(Application("blnForumClosed")) blnShowEditUser = CBool(Application("blnShowEditUser")) blnShowProcessTime = CBool(Application("blnShowProcessTime")) blnFlashFiles = CBool(Application("blnFlashFiles")) blnShowMod = CBool(Application("blnShowMod")) blnAvatarUploadEnabled = CBool(Application("blnAvatarUploadEnabled")) blnRegistrationSuspeneded = CBool(Application("blnRegistrationSuspeneded")) strImageTypes = Application("strImageTypes") End If 'If the forums are closed redirect to the forums closed page If blnForumClosed AND blnClosedForumPage = False Then 'Reset server objects Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing 'Redirect to the forum closed page Response.Redirect("forum_closed.asp") End If 'Initalise the process start time If blnShowProcessTime Then dblStartTime = Timer() 'Set a cookie with the last date/time the user used the forum to calculate if there any new posts 'If the date/time the user was last here is 20 minutes since the last visit then set the session variable to the users last date they were here If Session("dtmLastVisit") = "" AND Request.Cookies(strCookieName)("LTVST") <> "" Then Session("dtmLastVisit") = CDate(Request.Cookies(strCookieName)("LTVST")) Response.Cookies(strCookieName)("LTVST") = CDbl(Now()) Response.Cookies(strCookieName).Expires = DateAdd("yyyy", 1, Now()) 'If the last entry date is not alreay set set it to now ElseIf Session("dtmLastVisit") = "" Then Session("dtmLastVisit") = Now() End If 'If the cookie is older than 5 mintues set a new one If isNumeric(Request.Cookies(strCookieName)("LTVST")) Then If CDate(Request.Cookies(strCookieName)("LTVST")) < DateAdd("n", -5, Now()) Then Response.Cookies(strCookieName)("LTVST") = CDbl(Now()) Response.Cookies(strCookieName).Expires = DateAdd("yyyy", 1, Now()) End If 'If there is no date in the cookie or it is empty then set the date to now() Else Response.Cookies(strCookieName)("LTVST") = CDbl(Now()) Response.Cookies(strCookieName).Expires = DateAdd("yyyy", 1, Now()) End If 'If someone has placed the default.asp in the path to the forum then remove it as it's not needed strForumPath = Replace(strForumPath, "default.asp", "") 'Read in users ID number from the cookie strLoggedInUserCode = Trim(Mid(Request.Cookies(strCookieName)("UID"), 1, 44)) 'If a cookie exsists on the users system then read in there username from the database If strLoggedInUserCode <> "" Then 'Make the usercode SQL safe strLoggedInUserCode = formatSQLInput(strLoggedInUserCode) 'Initalise the strSQL variable with an SQL statement to query the database If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "ChkUserID @strUserID = '" & strLoggedInUserCode & "'" Else strSQL = "SELECT " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Group_ID, " & strDbTable & "Author.Active, " & strDbTable & "Author.Signature, " & strDbTable & "Author.Author_email, " & strDbTable & "Author.Date_format, " & strDbTable & "Author.Time_offset, " & strDbTable & "Author.Time_offset_hours, " & strDbTable & "Author.Reply_notify, " & strDbTable & "Author.Attach_signature, " & strDbTable & "Author.Rich_editor, " & strDbTable & "Author.Last_visit " strSQL = strSQL & "FROM " & strDbTable & "Author " strSQL = strSQL & "WHERE " & strDbTable & "Author.User_code = '" & strLoggedInUserCode & "';" End If 'Query the database rsCommon.Open strSQL, adoCon 'If the database has returned a record then run next bit If NOT rsCommon.EOF Then 'Read in the users details from the recordset strLoggedInUsername = rsCommon("Username") intGroupID = rsCommon("Group_ID") lngLoggedInUserID = CLng(rsCommon("Author_ID")) blnActiveMember = CBool(rsCommon("Active")) strDateFormat = rsCommon("Date_format") strTimeOffSet = rsCommon("Time_offset") intTimeOffSet = CInt(rsCommon("Time_offset_hours")) blnReplyNotify = CBool(rsCommon("Reply_notify")) blnAttachSignature = CBool(rsCommon("Attach_signature")) blnWYSIWYGEditor = CBool(rsCommon("Rich_editor")) strLoggedInUserEmail = rsCommon("Author_Email") If rsCommon("Signature") <> Trim("") Then blnLoggedInUserSignature = True 'See if the user has entered an email address If strLoggedInUserEmail <> Trim("") Then blnLoggedInUserEmail = True 'Read in the Last Visit Date for the user from the db if we haven't already If Session("ViRead") = "" Then If isDate(rsCommon("Last_visit")) Then Session("dtmLastVisit") = CDate(rsCommon("Last_visit")) Session("ViRead") = True End If 'Check that there is a last visit date in the db or we will get an error If isDate(rsCommon("Last_visit")) Then 'If the Last Visit date in the db is older than 5 minutes for the user then update it If CDate(rsCommon("Last_visit")) < DateAdd("n", -5, Now()) Then 'Initilse sql statement If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "UpdateLasVisit @lngUserID = " & lngLoggedInUserID Else strSQL = "UPDATE " & strDbTable & "Author SET " & strDbTable & "Author.Last_visit = Now() WHERE " & strDbTable & "Author.Author_ID=" & lngLoggedInUserID & ";" End If 'Write to database adoCon.Execute(strSQL) End If 'Else there is no date already in db for the last time this visitor came to the site so update db Else 'Initilse sql statement If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "UpdateLasVisit @lngUserID = " & lngLoggedInUserID Else strSQL = "UPDATE " & strDbTable & "Author SET " & strDbTable & "Author.Last_visit=Now() WHERE " & strDbTable & "Author.Author_ID=" & lngLoggedInUserID & ";" End If 'Write to database adoCon.Execute(strSQL) End If 'If the members account is not active then set there group to 2 (Guest Group) If blnActiveMember = False Then intGroupID = 2 'Set the Guest boolean to false blnGuest = False End If 'Clean up rsCommon.Close End If 'Make sure the main admin account remains active and full access rights and in the admin group If lngLoggedInUserID = 1 Then intGroupID = 1 blnActiveMember = True End If 'If in the admin group set the admin boolean to true If intGroupID = 1 Then blnAdmin = True 'If active users is on update the table If blnActiveUsers Then %>[an error occurred while processing this directive]<% End If %> [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide - Web Wiz Forums '** '** Copyright 2001-2004 Bruce Corkhill All Rights Reserved. '** '** This program is free software; you can modify (at your own risk) any part of it '** under the terms of the License that accompanies this software and use it both '** privately and commercially. '** '** All copyright notices must remain in tacked in the scripts and the '** outputted HTML. '** '** You may use parts of this program in your own private work, but you may NOT '** redistribute, repackage, or sell the whole or any part of this program even '** if it is modified or reverse engineered in whole or in part without express '** permission from the author. '** '** You may not pass the whole or any part of this application off as your own work. '** '** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place '** and must remain visible when the pages are viewed unless permission is first granted '** by the copyright holder. '** '** This program is distributed in the hope that it will be useful, '** but WITHOUT ANY WARRANTY; without even the implied warranty of '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER '** WARRANTIES WHETHER EXPRESSED OR IMPLIED. '** '** You should have received a copy of the License along with this program; '** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom. '** '** '** No official support is available for this program but you may post support questions at: - '** http://www.webwizguide.info/forum '** '** Support questions are NOT answered by e-mail ever! '** '** For correspondence or non support questions contact: - '** info@webwizguide.info '** '** or at: - '** '** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom '** '**************************************************************************************** '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 %> <% = strMainForumName %> <% Response.Write(vbCrLf & " ") Response.Write(vbCrLf & " ") Response.Write(vbCrLf & " ") 'If the user has not logged in (guest user ID = 2) then show them a quick login form If lngLoggedInUserID = 2 Then Response.Write(vbCrLf & " ") End If Response.Write(vbCrLf & " ") %>
" & strTxtTheTimeNowIs & " " & DateFormat(now(), saryDateTimeData) & " " & strTxtAt & " " & TimeFormat(now(), saryDateTimeData) & ".
") 'If this is not the first time the user has visted the site display the last visit time and date If Session("dtmLastVisit") < CDate(Request.Cookies(strCookieName)("LTVST")) Then Response.Write(strTxtYouLastVisitedOn & " " & DateFormat(Session("dtmLastVisit"), saryDateTimeData) & " " & strTxtAt & " " & TimeFormat(Session("dtmLastVisit"), saryDateTimeData) & ".") End If 'Display main page link if in a category view If intCatShow <> 0 Then Response.Write("
 " & strMainForumName & "") Response.Write(vbCrLf & "

") If blnLongSecurityCode Then Response.Write(strTxtLogin) Else Response.Write(strTxtQuickLogin) Response.Write(" " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " ") If blnLongSecurityCode = false Then Response.Write(vbCrLf & " ") Response.Write(vbCrLf & " " & _ vbCrLf & "
<% '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 (vbCrLf & "") '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 vbCrLf & "" '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 vbCrLf & "" '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 '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(vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " ") 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 %>
  <% = strTxtForum %> <% = strTxtTopics %> <% = strTxtPosts %> <% = strTxtLastPost %>
" & 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 (" ") 'If the forum requires a password diplay the password icon ElseIf strForumPassword <> "" Then 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 (" ") 'If the forum is read only show the locked new posts icon ElseIf blnForumLocked Then 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(vbCrLf & " ") '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(vbCrLf & " " & strForumName & "
" & strForumDiscription & strModeratorsList & "
" & lngNumberOfTopics & "" & lngNumberOfPosts & "" & DateFormat(dtmLastEntryDate, saryDateTimeData) & " " & strTxtAt & " " & TimeFormat(dtmLastEntryDate, saryDateTimeData) & "" & _ vbCrLf & "
" & strTxtBy & " " & strLastEntryUser & "

<% = strTxtForumStatistics %>
<% Response.Write(vbCrLf & " " & strTxtOurUserHavePosted & " " & lngTotalNumberOfPosts & " " & strTxtPostsIn & " " & lngTotalNumberOfTopics & " " & strTxtTopicsIn & " " & intNumberofForums & " " & strTxtForums) Response.Write(vbCrLf & "
" & strTxtLastPostOn & " " & DateFormat(dtmLastEntryDateAllForums, saryDateTimeData) & " " & strTxtAt & " " & TimeFormat(dtmLastEntryDateAllForums, saryDateTimeData) & " " & strTxtBy & " " & strLastEntryUserAllForums & "") '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(vbCrLf & "
" & strTxtWeHave & " " & rsCommon.RecordCount & " " & strTxtForumMembers & _ vbCrLf & "
" & strTxtTheNewestForumMember & " " & rsCommon("Username") & "") 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(vbCrLf & "
" & strTxtInTotalThereAre & " " & intActiveUsers & " " & strTxtActiveUsers & " " & strTxtOnLine & ", " & intActiveGuests & " " & strTxtGuestsAnd & " " & intActiveMembers & " " & strTxtMembers) If strMembersOnline <> "" Then Response.Write(vbCrLf & "
" & strTxtMembers & " " & strTxtOnLine & ": " & strMembersOnline) End If %>
<% 'Reset Server Objects Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing %>

<% = strTxtOpenForum %> <% = strTxtOpenForum %> <% = strTxtReadOnly %> <% = strTxtReadOnly %> <% = strTxtPasswordRequired %> <% = strTxtPasswordRequired %>
<% = strTxtOpenForumNewReplies %> <% = strTxtOpenForumNewReplies %> <% = strTxtReadOnlyNewReplies %> <% = strTxtReadOnlyNewReplies %> <% = strTxtNoAccess %> <% = strTxtNoAccess %>

<% = strTxtMarkAllPostsAsRead %> :: <% = strTxtDeleteCookiesSetByThisForum %>

<% = strTxtCookies %>

<% '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** If blnLCode = True Then If blnTextLinks = True Then Response.Write("Powered by Web Wiz Forums version " & strVersion & "") Else Response.Write("") End If Response.Write("
Copyright ©2001-2004 Web Wiz Guide") End If '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** 'Display the process time If blnShowProcessTime Then Response.Write "

" & strTxtThisPageWasGeneratedIn & " " & FormatNumber(Timer() - dblStartTime, 4) & " " & strTxtSeconds & "
" %>