%@ LANGUAGE=VBScript %>
![]()
|
|||||
|
|
|||||
| home >> guestbook | |||||
|
Feel free to leave your comments for the rest of the Madison High Class of 1986. (NOTE: Rude and obscene messages will be deleted.)
The guestbook will be down until site renovations are complete. <% 'db connection Dim cnnSimple Dim rstSimple Dim strDBPath Dim strSQL 'guestbook vars Dim pageTotal Dim recordTotal Dim pageNow Dim recordCount 'is used 2 times for a different process... Dim recordStart Dim cursorPlace Dim pageLength 'pageLength is the length of your page, set manually according to your layout pageLength = 10 strDBPath = Server.MapPath("../database/raguestbook.mdb") Set cnnSimple = Server.CreateObject("ADODB.Connection") cnnSimple.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";" ' strSQL = "SELECT * FROM guestbook ORDER BY userID DESC" ' strSQL = "SELECT * FROM guestbook WHERE content NOT LIKE '%RKWDL%' OR '%http://%' ORDER BY userID DESC" ' strSQL = "SELECT * FROM guestbook WHERE content NOT LIKE '%http://%' ORDER BY userID DESC" strSQL = "SELECT * FROM guestbook WHERE content NOT LIKE '%http://%' AND content NOT LIKE '%www.%' ORDER BY userID DESC" Set rstSimple = cnnSimple.Execute(strSQL) 'determine page If Request.QueryString("page") = "" Then pageNow = 1 Else pageNow = CInt(Request.QueryString("page")) End If 'count records, this is the easiest way to do it, and as long as your db doesn't 'have k's of records it's ok to use. Do While Not rstSimple.EOF recordCount = recordCount + 1 rstSimple.MoveNext Loop rstSimple.MoveFirst pageTotal = (recordCount / pageLength) If Int(pageTotal) = 0 then pageTotal = 1 If (pageTotal / Int(pageTotal)) <> 1 Then pageTotal = Int(pageTotal) + 1 'display page x of x If pageNow > pageTotal Then pageNow = pageTotal If pageNow < 1 Then pageNow = 1 %> page <%= pageNow %> of <%= pageTotal %> <% 'page selction If pageNow <> 1 Then %> previous <% End If If pageNow < pageTotal Then %>next <% End If %> <% 'record to start with recordStart = ((pageNow -1) * pageLength) If recordStart = 0 Then recordStart =1 'get the cursor to the right place. Do While cursorPlace < recordStart AND NOT recordStart = 1 rstSimple.MoveNext cursorPlace = cursorPlace + 1 Loop 'Here we go, display the guestbook. I kept the code as simple as possible 'so there's no layout at all... recordCount = 0 Do While recordCount < pageLength And Not rstSimple.EOF %>
<% rstSimple.MoveNext recordCount = recordCount + 1 Loop 'pageselection, same as above If pageNow <> 1 Then %>previous |<% end if if pageNow < pageTotal Then %>next<% End If %> |
|||||
|
Please see the mhs86.com Privacy Policy. |
|||||