% Option Explicit %>
<%
'****************************************************************************************
'** Copyright Notice
'**
'** Web Wiz Guide - Web Wiz Guestbook
'** http://www.webwizguestbook.com
'**
'** Copyright 2001-2006 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
'**
'****************************************************************************************
'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
%>
Guest Book
<%
'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
Response.Write("" & vbCrLf & vbCrLf)
'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
%>
Welcome to the guestbook. If you would like to sign the guest book then click on the link below. Sign the guest book |
<%
'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
If blnLCode Then Response.Write(strHeaderAds)
'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
'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 |
| <% = 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) OR 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
%> |
<%
%>
<%
'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
If blnLCode Then
Response.Write("
Powered by Web Wiz Guestbook version " & strVersion & "")
Response.Write("
Copyright ©2001-2006 Web Wiz Guide")
End If
'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
%>