home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / uaktualnienia / OptionPackPL / iis4_02.cab / guestbk.asp < prev    next >
Encoding:
Text File  |  1998-04-27  |  6.4 KB  |  203 lines

  1. <% @ LANGUAGE="VBSCRIPT" %>
  2. <%
  3.  OPTION EXPLICIT
  4.  DIM L_Guestbook, count, CursorType, intMID,objConn ,rst, strProvider, strQuery, StrSort
  5.     L_Guestbook = "Ksi╣┐ka go£ci"
  6.  
  7. '    $Date: 10/20/97 4:17p $
  8. '    $ModTime: $
  9. '    $Revision: 17 $
  10. '    $Workfile: guestbk.asp $
  11.  
  12.     If request.QueryString("message") <> "" Then
  13.         intMID = request.QueryString("message")
  14.     End If
  15.     If request.Form("MessageID") <> "" Then
  16.         intMID = request.Form("MessageID")
  17.     End If
  18.  If request.Form("next") <> "" OR request.Form("prev") <> "" Then
  19.     Set rst = Session("rst")
  20.     If request.Form("next") <> "" Then
  21.         rst.MoveNext
  22.         intMID = rst("MessageID")
  23.     ElseIf request.Form("prev") <> "" Then
  24.         rst.MovePrevious
  25.         intMID = rst("MessageID")
  26.     End If
  27.  Else
  28.      If intMID <> "" Then
  29.         count = request.Querystring("Count") - 1
  30.          Set rst = Session("rst")
  31.         rst.MoveFirst
  32.         rst.Move count
  33.      Else
  34.         call setVariables
  35.         strProvider="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\iisadmin") & "\website\messages.mdb;"
  36.         Set rst = Server.CreateObject("ADODB.recordset")
  37.         rst.CursorType = 3
  38.         rst.CursorLocation = 3
  39.         rst.LockType = 3
  40.         rst.Open strQuery, strProvider
  41.         Set Session("rst") = rst
  42.      End If
  43.  End If
  44.  
  45.  
  46. %>
  47. <HTML>
  48. <HEAD>
  49.     <TITLE>Ksi╣┐ka go£ci</TITLE>
  50.     <!--#include virtual ="/iissamples/homepage/sub.inc"-->
  51. <%
  52.  call stylesheet
  53.  Function Title( n)
  54.     DIM strTitle
  55.     DIM H
  56.     If n <> "" AND Len(n) > 6 then
  57.         H = 2
  58.     Else
  59.         H = 1
  60.     End If
  61.     strTitle = "<H" & H & ">"
  62.     If n <> "" Then
  63.         strTitle = strTitle & MyInfo.Name & ""
  64.         If right(myInfo.Name, 1) <> "s" then
  65.             strTitle = strTitle & " "
  66.         End If
  67.     End If
  68.     strTitle = strTitle & "- " & L_Guestbook
  69.     strTitle = strTitle & "</H" & H & ">"
  70.     Title = strTitle
  71.  End Function
  72.  
  73.  Sub Build_Table
  74.     Dim strTable, num, field(), fieldname(5), sort(3)
  75.     fieldname(0) = "Data:"
  76.     fieldname(1) = "Nazwa:"
  77.     fieldname(2) = "Adres e-mail:"
  78.     fieldname(3) = "Strona g│≤wna:"
  79.     fieldname(4) = "Temat:"
  80.     fieldname(5) = "Wiadomo£µ:"
  81.     num=0
  82.     strTable = "<TR>"
  83.  If rst.EOF Then
  84.     response.Write "<TR><TD Align='center' VAlign='middle' ColSpan=3 class='bg0' BGColor='#FFFFFF'>Brak wpis≤w w ksi╣┐ce go£ci</TD></TR>"
  85.  ElseIf intMID <> "" Then
  86.     REDIM field(6)
  87.     field(0) = rst("MessageDate")
  88.     field(1) = rst("MessageFrom")
  89.     field(2) = rst("Email")
  90.     field(3) = rst("URL")
  91.     field(4) = rst("MessageSubject")
  92.     field(5) = rst("MessageBody")
  93.     field(6) = rst("MessageID")
  94.     Dim cell_left, cell_right, row_break
  95.         cell_left = "<TD  ColSpan=2 BGColor='#FFFFFF' ALIGN=LEFT VALIGN=TOP><FONT SIZE='-1' FACE='arial','Arial'>"
  96.         cell_right = "<TR><TD BGColor='#FFFFFF' ALIGN=RIGHT VALIGN=TOP><FONT SIZE='-1' FACE='arial','Arial'>"
  97.         row_break = "<TR><TD height=1 Colspan=3></TD></TR>"
  98.     For num = 0 to 5
  99.         strTable = strTable & cell_right & "<B>" & fieldname(num) & "</B></FONT></TD>"
  100.         If num = 2 then
  101.             strTable = strTable    & cell_left & "<A HREF=""" & "mailto:" & field(num) & """>" & field(num) & "</A></TD></TR>" & row_break
  102.         Else
  103.             strTable = strTable    & cell_left & field(num) & "</TD></TR>" & row_break
  104.         End If
  105.  
  106.     Next
  107.     num=0
  108.   Else
  109.     sort(0) = "sortuj wed│ug daty"
  110.     sort(1) = "sortuj wed│ug autora"
  111.     sort(2) = "sortuj wed│ug tematu"
  112.     For num = 0 to 2
  113.         strTable = strTable & "<TD BGColor='#FFFFFF' WIDTH=125 Height='30' Align='LEFT' Valign='TOP'><INPUT NAME=sort value=""" & sort(num) & """ type=submit></TD>"
  114.     Next
  115.     num = 0
  116.     strTable = strTable & "</TR><TR><TD HEIGHT=1 Colspan=3></TD></TR>"
  117.     count = 1
  118.     Do UNTIL rst.EOF
  119.         strTable = strTable & "<TR>"
  120.             strTable = strTable & "<TD ALIGN=LEFT VALIGN=TOP BGColor='#FFFFFF'><FONT SIZE='-1' FACE='arial','Arial'>"  & rst("MessageDate") & "</FONT></TD>"
  121.             strTable = strTable & "<TD ALIGN=LEFT VALIGN=TOP BGColor='#FFFFFF'><FONT SIZE='-1' FACE='arial','Arial'><A HREF=""" & "guestbk.asp?message=" & rst("MessageID") & "&count=" & count & """>"  & rst("MessageFrom") & "</A></FONT></TD>"
  122.             strTable = strTable & "<TD ALIGN=LEFT VALIGN=TOP BGColor='#FFFFFF'><FONT SIZE='-1' FACE='arial','Arial'><A HREF=""" & "guestbk.asp?message=" & rst("MessageID") & "&count=" & count & """>"  & rst("MessageSubject") & "</A></FONT></TD>"
  123.         num = 0
  124.         strTable = strTable & "</TR><TR><TD HEIGHT=1 Colspan=3></TD></TR>"  'break the row
  125.         rst.MoveNext
  126.         count = count + 1
  127.     Loop
  128.   End If
  129.     response.write strTable
  130.  End Sub
  131.  
  132. '    ***    Creates input buttons.
  133.  Function FormSubmit( t, name, value )
  134.     Dim btnSubmit
  135.     btnSubmit = "<INPUT TYPE=""" & t & """ NAME=""" & name & """ VALUE=""" & value & """>"
  136.     FormSubmit = btnSubmit
  137.  End Function
  138.  
  139.  Sub navigationButtons
  140.     If intMID <> "" Then
  141.     response.write "<TR><TD ALIGN='center' Width='50%'>"
  142.         rst.MovePrevious
  143.         If not rst.BOF Then
  144.             response.write FormSubmit("SUBMIT", "prev", "<<")
  145.         Else
  146.             response.write "    "
  147.         End If
  148.         rst.MoveNext
  149.             response.write "</TD><TD ALIGN='center'> </TD><TD ALIGN='center' Width='50%'>"
  150.         rst.MoveNext
  151.         If not rst.EOF Then
  152.             response.write FormSubmit("SUBMIT", "next", ">>")
  153.         Else
  154.             response.write "   "
  155.         End If
  156.         rst.MovePrevious
  157.         response.write FormSubmit("HIDDEN", "MessageID", rst("MessageID"))_
  158.         & "</TD></TR><TR><TD Colspan=3><B>"_
  159.         & "<A HREF=""" & "guestbk.asp" & """>Powr≤t do ksi╣┐ki go£ci</A><BR>"
  160.     Else
  161.         response.write "<TR><TD Colspan=3 height=50 rowspan=2><B>"
  162.     End If
  163.         response.write "<A HREF=""" & "Signbook.asp" & """>Kliknij tutaj, aby siΩ wpisaµ do ksi╣┐ki go£ci</A><BR>"_
  164.         & "<A HREF=""" & "/" & """>Powr≤t do strony g│≤wnej</A>"_
  165.         & "</TD></TR>"
  166.  End Sub
  167.  
  168.  Sub setVariables
  169.     strQuery ="SELECT * FROM messages WHERE MessagePrivate = 0"
  170.     StrSort = request.form("sort")
  171.     Select Case StrSort
  172.     Case "sortuj wed│ug autora"
  173.         StrSort = "MessageFrom"
  174.     Case "sortuj wed│ug tematu"
  175.         StrSort = "MessageSubject"
  176.     Case Else
  177.         StrSort = "MessageDate DESC"
  178.     End Select
  179.     strQuery= strquery & " ORDER BY " & StrSort
  180.  End Sub
  181. %>
  182. </HEAD>
  183. <BODY TopMargin=0 Leftmargin="0" BGColor="#FFFFFF">
  184. <FORM ACTION=guestbk.asp method=post>
  185. <TABLE BORDER="0" cellspacing="0" cellpadding=5 width="100%" height="100%" class="bg0">
  186.     <TR><TD class=bg2 Rowspan="4" Width="5%" Height="100%"> </TD>
  187.         <TD Width="95%" Height="15%" class=bg3 Colspan=3><H1>
  188.         <%
  189.          response.write Title(myinfo.Name)
  190.         %>        
  191.         </H1></TD></TR>
  192.     <TR><TD Align="left" VAlign="top" Colspan=3>
  193.         <TABLE BORDER="0" cellspacing=0 cellpadding=5 Width="100%">
  194.         <%
  195.             call Build_Table
  196.         %>
  197.         </TABLE></TD></TR>
  198.         <% call navigationButtons %>
  199. </TABLE>
  200. </FORM>
  201. </BODY>
  202. </HTML>
  203.