Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
10 KiB

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <%
  3. Option Explicit
  4. DIM count, intMessageID, L_Dropbox, L_Guestbook, MessagePrivate, DBConn, CursorLocation, CursorType, strIDNum, cm, dateQuery, dateQueryString, fromQuery, fromQueryString, i, intMid, delete, nextCursor, nextMid, previous, location, background, MessageDateLimit, MessageDate, MessageID, MessageFromLimit, MessageFrom, MessageSubjectLimit, MessageSubject, msgprivate, objConn, objParam, rows, rowsLimit, rst, strpageType, strProvider, strQuery, StrSort, subjectQuery, subjectQueryString, tableCell, Theme
  5. L_Dropbox = "Drop Box"
  6. L_Guestbook = "Guest Book"
  7. If request.QueryString("message") <> "" Then
  8. intMessageID = request.QueryString("message")
  9. End If
  10. If request.Form("MessageID") <> "" Then
  11. intMessageID = request.Form("MessageID")
  12. End If
  13. If request.Form("delete") <> "" OR request.Form("next") <> "" OR request.Form("prev") <> "" Then
  14. If intMessageID <> "" Then
  15. Set rst = Session("rst")
  16. If request.Form("next") <> "" Then
  17. rst.MoveNext
  18. MessagePrivate = rst("MessagePrivate")
  19. intMessageID = rst("MessageID")
  20. ElseIf request.Form("prev") <> "" Then
  21. rst.MovePrevious
  22. MessagePrivate = rst("MessagePrivate")
  23. intMessageID = rst("MessageID")
  24. ElseIf request.Form("delete") <> "" Then
  25. MessagePrivate = rst("MessagePrivate")
  26. intMessageID = ""
  27. rst.Delete
  28. rst.Requery
  29. End If
  30. End If
  31. Else
  32. If request.QueryString("private") = "True" OR request.Form("private") = "True" Then
  33. MessagePrivate = "True"
  34. Else
  35. MessagePrivate = "False"
  36. End If
  37. If intMessageID <> "" Then
  38. Set rst = Session("rst")
  39. rst.MoveFirst
  40. count = request.Querystring("Count") - 1
  41. Set rst = Session("rst")
  42. rst.MoveFirst
  43. rst.Move count
  44. Else
  45. call setVariables
  46. call queryLimits 'Sets strQuery
  47. strProvider="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\iisadmin") & "\website\messages.mdb;"
  48. Set rst = Server.CreateObject("ADODB.recordset")
  49. rst.CursorType = 3
  50. rst.CursorLocation = 3
  51. rst.LockType = 3
  52. rst.Open strQuery, strProvider
  53. Set Session("rst") = rst
  54. End If
  55. End If
  56. %>
  57. <HTML>
  58. <!--
  59. $Date: 10/01/97 10:13a $
  60. $ModTime: $
  61. $Revision: 19 $
  62. $Workfile: admin.asp $
  63. -->
  64. <HEAD>
  65. <TITLE>Message Center</TITLE>
  66. <!--#include virtual ="/iissamples/homepage/sub.inc"-->
  67. <%
  68. Function Title( n, p )
  69. DIM strTitle
  70. DIM H
  71. If n <> "" AND Len(n) > 6 then
  72. H = 2
  73. Else
  74. H = 1
  75. End If
  76. strTitle = "<H" & H & ">"
  77. If n <> "" Then
  78. strTitle = strTitle & MyInfo.Name & "'"
  79. If right(myInfo.Name, 1) <> "s" then
  80. strTitle = strTitle & "s "
  81. End If
  82. End If
  83. If p = "True" Then
  84. strTitle = strTitle & L_Dropbox
  85. Else
  86. strTitle = strTitle & L_Guestbook
  87. End If
  88. strTitle = strTitle & "</H" & H & ">"
  89. Title = strTitle
  90. End Function
  91. Sub buildTable
  92. Set rst = Session("rst")
  93. If rst.EOF Then
  94. If intMessageID <> "" Then
  95. response.Write "<TR><TD Colspan='3'>There are no more messages.</TD></TR>"
  96. ElseIf request.QueryString("MessageDateLimit") <> "" Then
  97. response.Write "<TR><TD Colspan='3'>There are no messages that meet your criteria.</TD></TR>"
  98. Else
  99. response.Write "<TR><TD BGColor='#FFFFFF' Colspan='3'>There are no entries in your "
  100. If MessagePrivate = "False" Then
  101. response.write lcase(L_guestbook)
  102. Else
  103. response.write lcase(L_dropbox)
  104. End If
  105. response.write ".</TD></TR>"
  106. End If
  107. ElseIf intMessageID <> "" Then
  108. Dim col1Cell
  109. Dim col5Cell
  110. Dim colFont
  111. col5Cell = "<TD BGColor='#FFFFFF' ALIGN=left VALIGN=TOP COLSPAN=5><FONT style='font-family:verdana;font-size:8pt'>"
  112. col1Cell = "<TD BGColor='#FFFFFF' ALIGN=right VALIGN=TOP COLSPAN=1><FONT style='font-family:verdana;font-size:10pt'>"
  113. Response.Write "<TR>"_
  114. & col1Cell & "<B>Date:</B></FONT></TD>"_
  115. & col5Cell & rst("MessageDate") & "</TD></TR>"_
  116. & "<TR>" & col1Cell & "<B>Name:</B></FONT></TD>"_
  117. & col5Cell & rst("MessageFrom") & "</FONT></TD></TR>"_
  118. & "<TR>" & col1Cell & "<B>Email:</B></FONT></TD>"_
  119. & col5Cell & "<A HREF='mailto:" & rst("Email") & "'>" & rst("Email") & "</A></FONT></TD></TR>"_
  120. & "<TR>" & col1Cell & "<B>Home page:</B></FONT></TD>"_
  121. & col5Cell & "<A HREF='" & rst("URL") & "' TARGET='_blank'>" & rst("URL") & "</A></FONT></TD></TR>"_
  122. & "<TR>" & col1Cell & "<B>Subject:</B></FONT></TD>"_
  123. & col5Cell & rst("MessageSubject") & "</FONT></TD></TR>"_
  124. & "<TR>" & col1Cell & "<B>Message:</B></FONT></TD>"_
  125. & col5Cell & "<FONT SIZE='-1' FACE='arial','helvetica'>" & rst("MessageBody") & "</FONT></TD>"_
  126. & "</TR><TR><TD HEIGHT=5 Colspan=6>" & FormSubmit( "HIDDEN", "private", MessagePrivate ) & "</TD></TR>"
  127. Else
  128. tableCell = "<TD ALIGN=LEFT VALIGN=TOP BGColor='#FFFFFF'><FONT style='font-family:verdana;font-size:10pt'>"
  129. Response.Write "<TR><TD BGColor='#cccccc' WIDTH=125>"_
  130. & FormSubmit( "SUBMIT", "sort", "sort by date" )_
  131. & "</TD><TD BGColor='#cccccc'>"_
  132. & FormSubmit( "SUBMIT", "sort", "sort by author" )_
  133. & "</TD><TD BGColor='#cccccc'>"_
  134. & FormSubmit( "SUBMIT", "sort", "sort by subject" )_
  135. & FormSubmit( "HIDDEN", "private", MessagePrivate )_
  136. & "</TD></TR><TR><TD HEIGHT=1 Colspan=3 BGColor='#FFFFFF'></TD></TR>"
  137. count = 1
  138. Do UNTIL rst.EOF
  139. Response.Write "<TR>" & tableCell & rst("MessageDate") & "</A></FONT></TD>"_
  140. & tableCell & "<A HREF=""" & "admin.asp?message=" & rst("MessageID") & "&count=" & count & "&private=" & rst("MessagePrivate") & """>" & rst("MessageFrom") & "</A></FONT></TD>"_
  141. & tableCell & "<A HREF=""" & "admin.asp?message=" & rst("MessageID") & "&count=" & count & "&private=" & rst("MessagePrivate") & """>" & rst("MessageSubject") & "</A></FONT></TD>"
  142. rst.MoveNext
  143. Response.Write "</TR><TR><TD HEIGHT=1 Colspan=3></TD></TR>"
  144. count = count + 1
  145. Loop
  146. End If
  147. End Sub
  148. ' *** Creates input buttons.
  149. Function FormSubmit( t, name, value )
  150. Dim btnSubmit
  151. btnSubmit = "<INPUT TYPE=""" & t & """ NAME=""" & name & """ VALUE=""" & value & """>"
  152. FormSubmit = btnSubmit
  153. End Function
  154. Sub navigationButtons
  155. If intMessageID <> "" Then
  156. response.write "<TR><TD ALIGN='center' colspan='6'>"
  157. rst.MovePrevious
  158. If not rst.BOF Then
  159. response.write FormSubmit("SUBMIT", "prev", "<<")
  160. End If
  161. rst.MoveNext
  162. response.write FormSubmit("SUBMIT", "delete", "Delete message")
  163. rst.MoveNext
  164. If not rst.EOF Then
  165. response.write FormSubmit("SUBMIT", "next", ">>")
  166. End If
  167. rst.MovePrevious
  168. response.write FormSubmit("HIDDEN", "MessageID", rst("MessageID"))
  169. response.write "</TD></TR><TR><TD Colspan=6><B>"
  170. If MessagePrivate ="True" Then
  171. response.write "<A HREF='admin.asp?private=True'>Return to the " & L_Dropbox & "</A><BR>"
  172. Else
  173. response.write "<A HREF='admin.asp?private=False&strQuery=" & strQuery & "'>Return to the " & L_Guestbook & "</A><BR>"_
  174. End If
  175. Else
  176. response.write "<TR><TD Colspan=3><B>"
  177. If MessagePrivate <> "True" Then
  178. response.write "<A HREF='qbe.asp'>New Query</A><BR>"
  179. End If
  180. End If
  181. response.write "<A HREF='default.asp'>Web Site</A></B></TD></TR>"
  182. End Sub
  183. Sub setVariables
  184. StrSort = request.form("sort")
  185. Select Case StrSort
  186. Case "sort by author"
  187. StrSort = "MessageFrom"
  188. Case "sort by subject"
  189. StrSort = "MessageSubject"
  190. Case Else
  191. StrSort = "MessageDate"
  192. End Select
  193. MessageDateLimit = request.Form("MessageDateLimit")
  194. MessageDate = request.Form("MessageDate")
  195. If IsDate(MessageDate) Then
  196. MessageDate = MessageDate
  197. Else
  198. MessageDate = month( now ) & "/" & day( now ) & "/" & year( now ) & " " & time()
  199. End If
  200. MessageFromLimit = request.Form("MessageFromLimit")
  201. MessageFrom = request.Form("MessageFrom")
  202. MessageSubjectLimit = request.Form("messageSubjectLimit")
  203. MessageSubject = request.Form("messageSubject")
  204. End Sub
  205. Sub queryLimits
  206. strQuery ="SELECT * FROM messages WHERE MessagePrivate =" & MessagePrivate
  207. If MessageDate <> "" or MessageFrom <> "" or MessageSubject <> "" Then
  208. if Hour(MessageDate) = 0 then
  209. If MessageDate <> "" Then
  210. If MessageDateLimit = "less than" Then
  211. strQuery = strQuery & " AND DateValue(MessageDate) < #" & MessageDate & "#"
  212. ElseIf MessageDateLimit = "equal to" Then
  213. strQuery = strQuery & " AND DateValue(MessageDate) = #" & MessageDate & "#"
  214. ElseIf MessageDateLimit = "greater than" Then
  215. strQuery = strQuery & " AND DateValue(MessageDate) > #" & MessageDate & "#"
  216. End If
  217. End If
  218. Else
  219. If MessageDate <> "" Then
  220. If MessageDateLimit = "less than" Then
  221. strQuery = strQuery & " AND MessageDate < #" & MessageDate & "#"
  222. ElseIf MessageDateLimit = "equal to" Then
  223. strQuery = strQuery & " AND MessageDate = #" & MessageDate & "#"
  224. ElseIf MessageDateLimit = "greater than" Then
  225. strQuery = strQuery & " AND MessageDate > #" & MessageDate & "#"
  226. End If
  227. End If
  228. End If
  229. If MessageFrom <> "" Then
  230. If request.form("MessageFromLimit") = "begins with" Then
  231. strQuery = strQuery & " AND MessageFrom LIKE '" & MessageFrom & "%'"
  232. ElseIf request.Form("MessageFromLimit") = "contains" Then
  233. strQuery = strQuery & " AND MessageFrom LIKE '" & "%" & MessageFrom & "%'"
  234. ElseIf request.Form("messageFromLimit") = "ends with" Then
  235. strQuery = strQuery & " AND MessageFrom LIKE '%" & MessageFrom & "'"
  236. ElseIf request.Form("messageFromLimit") = "equal to" Then
  237. strQuery = strQuery & " AND MessageFrom = '" & MessageFrom & "'"
  238. End If
  239. End If
  240. If MessageSubject <> "" Then
  241. If request.form("MessageSubjectLimit") = "begins with" Then
  242. strQuery = strQuery & " AND MessageSubject LIKE '" & MessageSubject & "%'"
  243. ElseIf request.Form("MessageSubjectLimit") = "contains" Then
  244. strQuery = strQuery & " AND MessageSubject LIKE '" & "%" & MessageSubject & "%'"
  245. ElseIf request.Form("MessageSubjectLimit") = "ends with" Then
  246. strQuery = strQuery & " AND MessageSubject LIKE '%" & MessageSubject & "'"
  247. ElseIf request.Form("MessageSubjectLimit") = "equal to" Then
  248. strQuery = strQuery & " AND MessageSubject = '" & MessageSubject & "'"
  249. End If
  250. End If
  251. End If
  252. strQuery= strquery & " ORDER BY " &StrSort
  253. End Sub
  254. %>
  255. </HEAD>
  256. <BODY TopMargin=0 Leftmargin="0" BGColor="#FFFFFF">
  257. <FORM ACTION="admin.asp" method="POST">
  258. <TABLE border=1 width="100%" height="100%" cellspacing=5 cellpadding=5 rules=box>
  259. <TR>
  260. <TD Background="msg.gif" Colspan="6">
  261. <H1>
  262. <%=Title(MyInfo.Name,MessagePrivate)%>
  263. </H1></TD>
  264. </TR>
  265. <%
  266. Call buildTable
  267. Call navigationButtons
  268. %>
  269. </TABLE>
  270. </FORM>
  271. </BODY>
  272. </HTML>