% Option Explicit %>
<%
'****************************************************************************************
'** Copyright Notice
'**
'** Web Wiz Guide - Web Wiz Guestbook
'**
'** 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
'**
'****************************************************************************************
'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 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
'Initiliase varibales
Const strVersion = "7.01"
Const strSalt = "5CB237B1D85"
Const strCodeField = "Code"
'Set up the database table name prefix and stored procedure prefix
'(This is useful if you are running multiple Guestbooks 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 = "tblGB"
'Database Type
'strDatabaseType = "Access"
strDatabaseType = "SQLServer"
'Create database connection
'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'--------------------- Set the path and name of the database --------------------------------------------------------------------------------
'Virtual path to database
strDbPathAndName = Server.MapPath("database/WWGguestbook.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\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.
'---------------------------------------------------------------------------------------------------------------------------------------------
'------------- 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
'---------------------------------------------------------------------------------------------------------------------------------------------
'Set the diffrent variables for diffrent database types
If strDatabaseType = "SQLServer" Then
%><%
'****************************************************************************************
'** Copyright Notice
'**
'** Web Wiz Guide - Web Wiz Guestbook
'**
'** 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
'**
'****************************************************************************************
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
'------------- The Driver Below is if you are using SQL Server (Do Not Use Unless you know and have an SQL Server) ---------------------------
'Enter the details of your SQL server below
strSQLServerName = "whsql01.prod.mesa1.secureserver.net" 'Holds the name of the SQL Server
strSQLDBUserName = "naveeny279" 'Holds the user name (for SQL Server Authentication)
strSQLDBPassword = "stupid" 'Holds the password (for SQL Server Authentication)
strSQLDBName = "DB_398" 'Holds name of a database on the server
'Please note the forum 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 forum and
'drastically reduce the performance of the forum!
'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 & ";"
'---------------------------------------------------------------------------------------------------------------------------------------------
%><%
End If
'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;"
'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
%>
<%
'****************************************************************************************
'** Copyright Notice
'**
'** Web Wiz Guide - Web Wiz Guestbook
'**
'** 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.com
'**
'** or at: -
'**
'** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom
'**
'****************************************************************************************
'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 intTotalNumGuestbookPages 'Holds the total number of pages in the database
Dim intLinkPageNum 'Holds the page number to be linked to
'If this is the first time the page is displayed then the guestbook record position is set to page 1
If Request.QueryString("PagePosition") = "" 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("PagePosition"))
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.* " & _
"FROM " & strDbTable & "Comments "
If strDatabaseType = "SQLServer" Then
strSQL = strSQL & "WHERE " & strDbTable & "Comments.Authorised = 1 "
Else
strSQL = strSQL & "WHERE " & strDbTable & "Comments.Authorised = true "
End If
strSQL = strSQL & "ORDER BY Date_stamp DESC;"
'Set the cursor type property of the record set to dynamic so we can naviagate through the record set
rsCommon.CursorType = 3
'Query the database
rsCommon.Open strSQL, adoCon
'Set the number of records to display on each page by the constant set at the top of the script
rsCommon.PageSize = intRecordsPerPage
'Get the guestbook record poistion to display from
If NOT rsCommon.EOF Then rsCommon.AbsolutePage = intRecordPositionPageNum
%>
Guest Book
<%
'If there is a Guestbook image then dsiplay it
If NOT strTitleImage = "" Then
Response.Write("
"
End If
%>
Welcome to the guestbook. If you would like to sign the guest book then click on the link below.
<%
'If there are no rcords in the database display an error message
If rsCommon.EOF 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"
Response.End
'Display the guestbook
Else
'Count the number of enties in the guestbook database
intTotalNumGuestbookEntries = rsCommon.RecordCount
'Count the number of pages there are in the guestbook database calculated by the PageSize attribute set above
intTotalNumGuestbookPages = rsCommon.PageCount
'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 <% = intTotalNumGuestbookPages %> pages and you are on page number <% = intRecordPositionPageNum %>
<%
'For....Next Loop to display records from the guestbook database
For intRecordLoopCounter = 1 to intRecordsPerPage
'If there are no guestbook records left to display then exit loop
If rsCommon.EOF Then Exit For
'Read in the values form the database
strName = rsCommon("Name")
strCountry = rsCommon("Country")
strEmailAddress = rsCommon("EMail")
dtmEntryDate = CDate(rsCommon("Date_stamp"))
strHomepage = rsCommon("Homepage")
strComments = rsCommon("Comments")
'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
<% = strComments %>
<% = strCountry %>
<% = strHomepage %>
<%
'Move to the next record in the database
rsCommon.MoveNext
'Loop back round
Next
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 intRecordPositionPageNum > 1 or NOT rsCommon.EOF 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
'If there are more pages to display then display links to all the pages
If intRecordPositionPageNum > 1 or NOT rsCommon.EOF Then
'Display a link for each page in the guestbook
For intLinkPageNum = 1 to intTotalNumGuestbookPages
'If there is more than 7 pages display ... last page and exit the loop
If intLinkPageNum > 15 Then
If intTotalNumGuestbookPages = intRecordPositionPageNum Then Response.Write(" ..." & intTotalNumGuestbookPages) Else Response.Write(" ..." & intTotalNumGuestbookPages & "")
'Exit Loop
Exit For
'Else display the normal link code
Else
'If the page to be linked to is the page displayed then don't make it a hyper-link
If intLinkPageNum = intRecordPositionPageNum Then Response.Write(" " & intLinkPageNum) Else Response.Write(" " & intLinkPageNum & "")
End If
Next
End If
'If it is Not the End of the guestbook entries then display a next link for the next guestbook page
If NOT rsCommon.EOF then
Response.Write (" Next >>")
End If
'Finsh HTML the table
%>
<%
'Reset Server Variables
rsCommon.Close
Set rsCommon = Nothing
adoCon.Close
Set adoCon = Nothing
%>