%@ Language=VBScript %> <% '********************************************************************************************* '******** ASP Guestbook by: Jeff Rosenzweig, tworoses@gate.net ******** '******** This application may be used and modified as long as proper credit ******** '******** is given to the author and no referneces to the author ******** '******** are removed from any of the pages. ******** '********************************************************************************************* '********************************************************************************************* '******** Declare all variables ******** '********************************************************************************************* Dim objConn 'Data Base Connection Dim rsUsers 'Data Base Recordset Dim rsCount 'Counts total number of records in recordset Dim intTotalEntries 'Variable to store the total number of records in recordset Dim fldF 'Fields of data base Dim intCounter 'Counter used to alternate table background colors Dim intKey 'Variable for determining last entry in each grouping of 5 Dim intX 'Variable for determining first entry in each grouping of 5 Dim intLoop 'Looping variable for cycling through Recordset Dim intEntry 'Variable for the current entry number Dim repeat 'Variable to determine if user has previously hit page or not Dim intTotal 'Total number of entries in Recordset Dim newURL 'URL with string attached, pointing to which records to be displayed Dim blnNext 'Determine if a next button should be displayed Dim blnPrevious 'Determine if a previous button should be displayed '********************************************************************************************* '******** Create & Open the connection and recordset ******** '********************************************************************************************* Set objConn = Server.CreateObject("ADODB.Connection") Set rsUsers = Server.CreateObject("ADODB.Recordset") Set rsCount = Server.CreateObject("ADODB.Recordset") objConn.Open "guests","","" 'strConnect = "Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\webhostme\4064\Web\cgi-bin\guests.mdb" 'objConn.Open strConnect rsUsers.Open "Entries", objConn,adOpenDynamic '********************************************************************************************* '******** Decide which records to display by ******** '******** checking if this is the first time to the page ******** '********************************************************************************************* Select Case Request("repeat") Case "yes" intX = Request("intX") intKey = Request("intKey") intX = intX - 5 If intX <= 1 then intX = 1 End If intKey = intKey - 5 rsUsers.Move (intKey) intTotalEntries = Request("intTotalEntries") Case "" rsUsers.MoveLast set rsCount = objConn.Execute ("select count (*) from Entries") intTotalEntries = rsCount (0) intKey=intTotalEntries intX=intKey-4 If intX <= 1 then intX = 1 End If End Select '********************************************************************************************* '******** Determine whether or not to display previous and next buttons ******** '******** Attach a string to the URL to identify where in the guestbook you are ******** '********************************************************************************************* If intX > 1 then Session("newURL")="view.asp?repeat=yes" & "&intx=" & intx & "&intKey=" & intKey & "&intTotalEntries=" & intTotalEntries blnNext=true End If If intKey < intTotalEntries Then blnPrevious=true End If '********************************************************************************************* '******** JavaScript for Previuos and Next Buttons Functions ******** '********************************************************************************************* %>
|
" & intTotalEntries &_ (" Total Entries - ") & "" & ("Displaying entries ") & intX &_ (" through ") & intKey & "
" '********************************************************************************************* '******** Dislay 5 entries at a time, each in it's own table ******** '******** Alternate between blue and gray backgrounds ******** '********************************************************************************************* intEntry = intKey For intLoop = intX to intKey Response.Write "Entry # " & intEntry & ""
intCounter=intCounter+1
If (intCounter Mod 2) = 0 Then
strBGColor = "Silver"
Else
strBGColor = "Navy"
End If
Response.Write ""
For Each fldF In rsUsers.Fields
If fldF.name = "Entry" then
else
Response.Write " "
end if
Next
intEntry = intEntry-1
Response.Write "" & fldF.name & ": " & ""
Response.Write "" & fldF.value & "
Add
an Entry
New
Logs | All Logs
| Route Maps | Links
| Sponsors | What's
New | Home | Contact
| Search