<% Option Explicit %> <% 'Declare variables Dim adoCon 'Database Connection Variable Dim rsCommon 'Holds the common recordset Dim strCon 'Holds the Database driver and the path and name of the database Dim strSQL 'Holds the SQL query for the database Dim strSQLServerName 'Holds the name of the SQL Server Dim strSQLDBUserName 'Holds the user name (for SQL Server Authentication) Dim strSQLDBPassword 'Holds the password (for SQL Server Authentication) Dim strSQLDBName 'Holds name of a database on the server Dim strDbPathAndName 'Holds the database path and name Dim intRecordsPerPage 'Holds the number of files shown on each page Dim strBgColour 'Holds the background colour of the guestbook Dim strTextColour 'Holds the text colour of the guestbook Dim strLinkColour 'Holds the link colour of the guestbook Dim strTextType 'Holds the font type of the guestbook Dim intTextSize 'Holds the font size of the guestbook Dim strTableColour 'Holds the table colour Dim strTableBorderColour 'Holds the table border colour Dim strTableTitleColour 'Holds the table title colour Dim strVisitedLinkColour 'Holds the visited link colour of the guestbook Dim strActiveLinkColour 'Holds the active link colour of the guestbook Dim strHoverLinkColour 'Holds the active link colour of the guestbook Dim blnLCode 'set to true Dim blnEmail 'Boolean set to true if e-mail is on Dim strCode 'Holds the page code Dim strCode2 'Holds the page code Dim strWebSiteEmailAddress 'Holds the e-mail address for the web site the Guestbook is on Dim strMailComponent 'Email coponent the guestbook useses Dim strSMTPServer 'SMTP server for sending the e-mails through Dim strLoggedInUserCode 'Holds the user code of the user Dim strTitleImage 'Holds the path and name for the title image for the guestbook Dim intMsgCharNo 'Holds the number of characters allowed for the messages Dim blnCookieSet 'Set to true if cookies are to be set to stop multiple posts Dim blnIPBlocking 'Set to true if IP blooking is to be used to stop multiple posts Dim strDatabaseType 'Holds the database type Dim blnSessionCheck 'Set to true if the session ID is checked Dim blnURL 'Set to true if user can post a URL Dim blnAuthorise 'Set to true if posts are to be authorised first Dim blnSecurityImages 'Set to true if security images are enabled Dim blnEmailAddress 'Set to true if an email address can be added to the comments Dim strDBFalse 'Holds the false value for SQL queries Dim strDBTrue 'Holds the true value for SQL queries Dim strDBNoLock 'Holds if the database is locked while running the query for SQL Server Dim strRowLock 'Holds if the database row is locked while running the query for SQL Server Dim strDBTop1 'Holds the SQL limit operator (TOP 1) for SQL Server and Access Dim strDBLimit1 'Holds the SQL limit operator (LIMIT 1) for mySQL 'Initiliase varibales Const strVersion = "8.01" Const strSalt = "5CB237B1D85" Const strCodeField = "Code" 'Create database connection 'Create a connection odject Set adoCon = Server.CreateObject("ADODB.Connection") 'Link to database setup include file %><% '****************************************** '*** Database System Type **** '****************************************** 'Database Type 'strDatabaseType = "SQLServer" 'Microsoft SQL Server 2000 or 2006 'strDatabaseType = "mySQL" 'mySQL 4+ strDatabaseType = "Access" 'Microsoft Access Database (Flat database file, slowest and least secure of the 3) '****************************************** '*** Microsoft Access **** '****************************************** If strDatabaseType = "Access" Then 'Microsoft Access is a flat file database system, it suffers from slow performance, limited 'connections, and as a flat file it can be easly downloaded by a hacker if you do not secure 'the database file 'Virtual path to database strDbPathAndName = Server.MapPath("_private/donkey/donkey.mdb") 'This is the path of the database from the applications location 'Physical path to database 'strDbPathAndName = "" 'Use this if you use the physical server path, eg:- C:\Inetpub\private\WWGguestbook.mdb 'BRINKSTER USERS 'Brinkster users remove the ' single quote mark from infront of the line below and replace USERNAME with your Brinkster uersname 'strDbPathAndName = Server.MapPath("/USERNAME/db/WWGguestbook.mdb") 'PLEASE NOTE: - For extra security it is highly recommended you change the name of the database, WWGguestbook.mdb, 'to another name and then replace the WWGguestbook.mdb found above with the name you changed the forum database to. 'Database driver (Microsoft JET OLE DB driver version 4) strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strDbPathAndName 'Set true and false for db strDBFalse = "false" strDBTrue = "true" 'Set the limit operator for Access strDBTop1 = " TOP 1" End If '****************************************** '*** Microsoft SQL Server **** '****************************************** If strDatabaseType = "SQLServer" Then 'SQL Server is a high performance database server, this requires that you have installed an 'instence SQL Server 2000 or 2005 with mixed mode connection and have created a database for 'the Guestbook on the SQL Server 'Enter the details of your Microsoft SQL Server and database below strSQLServerName = "" 'Holds the name of the SQL Server (This is the name/location or IP address of the SQL Server) strSQLDBUserName = "" 'Holds the user name (for SQL Server Authentication) strSQLDBPassword = "" 'Holds the password (for SQL Server Authentication) strSQLDBName = "" 'Holds name of a database on the server 'Please note this application has been optimised for the SQL OLE DB Driver using another driver 'or system DSN to connect to the SQL Server database will course errors in the application and 'drastically reduce the performance! 'The SQLOLEDB driver offers the highest performance at this time for connecting to SQL Server databases from within ASP. 'MS SQL Server OLE Driver (If you change this string make sure you also change it in the msSQL_server_setup.asp file when creating the database) strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";" 'Set true and false for db strDBFalse = 0 strDBTrue = 1 'Set the lock variavbles for the db strDBNoLock = " WITH (NOLOCK) " strRowLock = " WITH (ROWLOCK) " 'Set the Limit opertaor for SQL Server strDBTop1 = " TOP 1" End If '****************************************** '*** mySQL Database System **** '****************************************** If strDatabaseType = "mySQL" Then 'mySQL is a free database server, it's a very fast and robust, this requires that you have 'installed an instance of mySQL 4 or higher and have created an database for the Guestbook 'on the mySQL database system 'Enter the details of your mySQL and database below strSQLServerName = "" 'Holds the name of the mySQL (This is the name/location or IP address of the mySQL) strSQLDBUserName = "" 'Holds the user name (for mySQL Authentication) strSQLDBPassword = "" 'Holds the password (for mySQL Authentication) strSQLDBName = "" 'Holds name of a database on the server 'This application requires the myODBC 3.51 driver or higher 'myODBC Driver 3.51 strCon = "Driver={MySQL ODBC 3.51 Driver};Server=" & strSQLServerName & ";User=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";Port=3306;Option=3;" 'Set true and false for db (true value is -1) strDBFalse = 0 strDBTrue = -1 'Set the limit operator strDBLimit1 = " LIMIT 1" End If 'Set up the database table name prefix '(This is useful if you are running multiple Guestbooks from one database) Const strDbTable = "tblGB" %><% 'Set the connection string to the database adoCon.connectionstring = strCon 'Set an active connection to the Connection object adoCon.Open 'Read in the Guestbook configuration 'Intialise the ADO recordset object Set rsCommon = Server.CreateObject("ADODB.Recordset") 'Initialise the SQL variable with an SQL statement to get the configuration details from the database strSQL = "SELECT " & strDbTable & "Configuration.* " & _ "From " & strDbTable & "Configuration" & strDBNoLock & " " & _ "WHERE " & strDbTable & "Configuration.ID=1;" 'Query the database rsCommon.Open strSQL, strCon '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 strMailComponent = rsCommon("mail_component") strSMTPServer = rsCommon("mail_server") strBgColour = rsCommon("bg_colour") strTextColour = rsCommon("text_colour") strTextType = rsCommon("text_type") intTextSize = CInt(rsCommon("text_size")) strLinkColour = rsCommon("links_colour") strTableColour = rsCommon("table_colour") strTableBorderColour = rsCommon("table_border_colour") strTableTitleColour = rsCommon("table_title_colour") strVisitedLinkColour = rsCommon("visited_links_colour") strHoverLinkColour = rsCommon("active_links_colour") strWebSiteEmailAddress = rsCommon("email_address") blnLCode = CBool(rsCommon("Code")) blnEmail = CBool(rsCommon("email_notify")) intRecordsPerPage = CInt(rsCommon("Comments_per_page")) strTitleImage = rsCommon("Title_image") intMsgCharNo = rsCommon("Message_char_no") blnCookieSet = CBool(rsCommon("Cookie")) blnIPBlocking = CBool(rsCommon("IP_blocking")) blnSessionCheck = CBool(rsCommon("Session")) blnURL = CBool(rsCommon("URL")) blnAuthorise = CBool(rsCommon("Authorisation")) blnSecurityImages = CBool(rsCommon("Security_images")) blnEmailAddress = CBool(rsCommon("Email")) End If 'Close the recordset rsCommon.Close %> <% 'Dimesion variables Dim strHeaderAds 'Holds the ads in the header Dim strFooterAds 'Holds the ads in the footer 'You can chnage the following to change the colours of the ads '************************************** Const strAdBorderColour = "CCCCFF" Const strAdBackgroundColour = "FFFFFF" Const strAdLinkColour = "0000FF" Const strAdURLcolour = "0000FF" Const strAdTextColour = "000000" '************************************** %> <% 'Buffer the response Response.Buffer = True 'Dimension variables Dim strName 'Holds the Users name Dim strEmailAddress 'Holds the Users e-mail address Dim strCountry 'Holds the users country Dim strHomepage 'Holds the Users homepage Dim strComments 'Holds the Users comments Dim dtmEntryDate 'Holds the date the commnets where made Dim intRecordPositionPageNum 'Holds the record position Dim intRecordLoopCounter 'Loop counter for displaying the guestbook records Dim intTotalNumGuestbookEntries 'Holds the total number of records in the database Dim intLinkPageNum 'Holds the page number to be linked to Dim sarryGBcomments 'Holds the Guestbook comments Dim intTotalRecords 'Holds the number of records in the topics array Dim intTotalRecordsPages 'Holds the total number of pages Dim intStartPosition 'Holds the start poition for records to be shown Dim intEndPosition 'Holds the end poition for records to be shown Dim intCurrentRecord 'Holds the current record position 'If this is the first time the page is displayed then the guestbook record position is set to page 1 If Request.QueryString("PN") = "" Then intRecordPositionPageNum = 1 'Else the page has been displayed before so the guestbook record postion is set to the Record Position number Else intRecordPositionPageNum = CInt(Request.QueryString("PN")) End If 'Initalise the strSQL variable with an SQL statement to query the database by selecting all tables ordered by the decending date strSQL = "SELECT " & strDbTable & "Comments.MessageID, " & strDbTable & "Comments.Name, " & strDbTable & "Comments.Country, " & strDbTable & "Comments.EMail, " & strDbTable & "Comments.Date_stamp, " & strDbTable & "Comments.Homepage, " & strDbTable & "Comments.Comments " & _ "FROM " & strDbTable & "Comments" & strDBNoLock & " " & _ "WHERE " & strDbTable & "Comments.Authorised = " & strDBTrue & " " & _ "ORDER BY Date_stamp DESC;" 'Query the database rsCommon.Open strSQL, adoCon 'Read in the recordset details If NOT rsCommon.EOF Then 'Read in the guestbook recordset into an array sarryGBcomments = rsCommon.GetRows() 'Count the number of records intTotalRecords = Ubound(sarryGBcomments,2) + 1 'Count the number of pages for the topics using '\' so that any fraction is omitted intTotalRecordsPages = intTotalRecords \ intRecordsPerPage 'If there is a remainder or the result is 0 then add 1 to the total num of pages If intTotalRecords Mod intRecordsPerPage > 0 OR intTotalRecordsPages = 0 Then intTotalRecordsPages = intTotalRecordsPages + 1 'Start position intStartPosition = ((intRecordPositionPageNum - 1) * intRecordsPerPage) 'End Position intEndPosition = intStartPosition + intRecordsPerPage 'Get the start position intCurrentRecord = intStartPosition End If 'Close the recordset rsCommon.Close Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing %> Firefighters of Tampa Bay Pipes and Drums
 

Home page
Frequently Asked Questions
History
Gallery
Band Members
Member Profile
Merchandise
Donations
Links of interest
Guestbook
Contact

 

 
  " End If %>
<% 'If there is a Guestbook image then dsiplay it If NOT strTitleImage = "" Then Response.Write("
Welcome to the guestbook. If you would like to sign
the guest book then click on the link below.

Sign the guest book
<% 'If there are no rcords in the database display an error message If intTotalRecords <= 0 Then 'Tell the user there are no records to show Response.Write "
There are no records in the guestbook database" Response.Write "
Please check back later


" 'Display the guestbook Else 'Count the number of enties in the guestbook database intTotalNumGuestbookEntries = intTotalRecords 'Display the HTML number number the total number of pages and total number of records in the guestbook database %>

There are <% = intTotalNumGuestbookEntries %> guestbook entries in <% = intTotalRecordsPages %> pages and you are on page number <% = intRecordPositionPageNum %>

<% 'For....Next Loop to display records from the guestbook database Do While intCurrentRecord < intEndPosition 'If there are no guestbook records left to display then exit loop If intCurrentRecord >= intTotalRecords Then Exit Do 'Read in the values form the database strName = sarryGBcomments(1,intCurrentRecord) strCountry = sarryGBcomments(2,intCurrentRecord) strEmailAddress = sarryGBcomments(3,intCurrentRecord) dtmEntryDate = CDate(sarryGBcomments(4,intCurrentRecord)) strHomepage = sarryGBcomments(5,intCurrentRecord) strComments = sarryGBcomments(6,intCurrentRecord) 'If URL homepgae entry is diisabled don't show URL If blnURL = false Then strHomepage = "" 'If there is no homepage entry to display the display no URL given ElseIf strHomepage = "http://" or strHomepage = "" then strHomepage = "no URL given" 'Else turn the URL stored in the strHomepage variable into a hyperlink Else strHomepage = "" & strHomepage & "" End If 'Write the HTML to the web browser to display the guestbook entries %>
Comments by <% 'Display the email address if there is one If blnEmailAddress AND strEmailAddress <> "" Then Response.Write("" & strName & "") Else Response.Write(strName) %> on <% = FormatDateTime(dtmEntryDate, VbLongDate) %> at <% = FormatDateTime(dtmEntryDate, VbShortTime) %> IP Logged IP Logged
<% = strComments %>
<% = strCountry %> <% = strHomepage %>

<% 'Move to the next record intCurrentRecord = intCurrentRecord + 1 'Loop back round Loop End If 'Display an HTML table with links to the other entries in the guestbook %>
<% 'If there are more pages to display then add a title to the other pages If intTotalRecordsPages > 1 Then Response.Write vbCrLf & " Page:  " End If 'If the guestbook page number is higher than page 1 then display a back link If intRecordPositionPageNum > 1 Then Response.Write vbCrLf & ("<< Prev") End If 'Always display a link to page 1... If intTotalRecordsPages > 10 AND intRecordPositionPageNum > 5 Then Response.Write(" 1...") 'If there is more than 1 page to display, display links to other pages If intTotalRecordsPages > 1 Then 'Loop through and display links to the other pages (-5 and +5 current page) For intLinkPageNum = 1 to intTotalRecordsPages 'Show link if within 5 of the current page If intLinkPageNum < intRecordPositionPageNum + 5 AND intLinkPageNum > intRecordPositionPageNum - 5 Then 'Display static number for the page we are on If intLinkPageNum = intRecordPositionPageNum Then Response.Write(" " & intLinkPageNum) 'Display link if it is to another page Else Response.Write(" " & intLinkPageNum & "") End If End If Next End If 'Always display a link to ...lastpage If intTotalRecordsPages > 10 AND intRecordPositionPageNum < intTotalRecordsPages-4 Then Response.Write("..." & intTotalRecordsPages & " ") 'If it is Not the End of the guestbook entries then display a next link for the next guestbook page If intTotalRecordsPages > intRecordPositionPageNum then Response.Write (" Next >>") End If 'Finsh HTML the table %>
<% %>

<% %>