%@LANGUAGE="VBSCRIPT"%>
<%
curpath = "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL")
curpath = Left(curpath, InstrRev(curpath, "/"))
%>
<%
Dim rsBlogSite
Dim rsBlogSite_numRows
Set rsBlogSite = Server.CreateObject("ADODB.Recordset")
rsBlogSite.ActiveConnection = MM_blog_STRING
rsBlogSite.Source = "SELECT * FROM tblBlogRSS"
rsBlogSite.CursorType = 0
rsBlogSite.CursorLocation = 2
rsBlogSite.LockType = 1
rsBlogSite.Open()
rsBlogSite_numRows = 0
%>
<%
Dim rsCats
Dim rsCats_numRows
Set rsCats = Server.CreateObject("ADODB.Recordset")
rsCats.ActiveConnection = MM_blog_STRING
rsCats.Source = "SELECT *, (SELECT COUNT(*) FROM tblBlog WHERE tblBlog.BlogCat = tblCat.CatID) as CatCount FROM tblCat ORDER BY CatName ASC"
rsCats.CursorType = 0
rsCats.CursorLocation = 2
rsCats.LockType = 1
rsCats.Open()
rsCats_numRows = 0
%>
<%
Dim rsArchives
Dim rsArchives_numRows
Set rsArchives = Server.CreateObject("ADODB.Recordset")
rsArchives.ActiveConnection = MM_blog_STRING
rsArchives.Source = "SELECT DISTINCT Month(BlogDate) as ArchiveMonth, Year(BlogDate) as ArchiveYear FROM tblBlog ORDER BY Year(BlogDate) DESC, Month(BlogDate) DESC"
rsArchives.CursorType = 0
rsArchives.CursorLocation = 2
rsArchives.LockType = 1
rsArchives.Open()
rsArchives_numRows = 0
%>
<%
Dim rs_cat__MMColParam
rs_cat__MMColParam = Request("id")
%>
<%
Dim rsArticles
Dim rsArticles_numRows
Set rsArticles = Server.CreateObject("ADODB.Recordset")
rsArticles.ActiveConnection = MM_blog_STRING
rsArticles.Source = "SELECT * , (SELECT COUNT(*) FROM tblComment WHERE tblComment.BlogID = tblBlog.BlogID AND tblComment.CommentInclude = 1) as CommentCount, (SELECT COUNT(*) FROM tblBlog WHERE BlogCat = CatID) as CategoryCount FROM tblBlog, tblCat, tblAuthor WHERE BlogID = " & rs_cat__MMColParam & " AND BlogCat = CatID AND tblBlog.BlogAuthor = tblAuthor.fldAuthorID ORDER BY BlogDate DESC"
rsArticles.CursorType = 0
rsArticles.CursorLocation = 2
rsArticles.LockType = 1
rsArticles.Open()
rsArticles_numRows = 0
%>
<%
Dim rsRecent
Dim rsRecent_numRows
Set rsRecent = Server.CreateObject("ADODB.Recordset")
rsRecent.ActiveConnection = MM_blog_STRING
rsRecent.Source = "SELECT * FROM tblBlog ORDER by BlogDate DESC"
rsRecent.CursorType = 0
rsRecent.CursorLocation = 2
rsRecent.LockType = 1
rsRecent.Open()
rsRecent_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsBlogSite_numRows = rsBlogSite_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
rsArchives_numRows = rsArchives_numRows + Repeat2__numRows
%>
<%
Dim Repeat4__numRows
Dim Repeat4__index
Repeat4__numRows = 10
Repeat4__index = 0
rsRecent_numRows = rsRecent_numRows + Repeat4__numRows
%>
<%
Dim Repeat3__numRows
Dim Repeat3__index
Repeat3__numRows = 20
Repeat3__index = 0
rsArticles_numRows = rsArticles_numRows + Repeat3__numRows
%>
<%
If cstr(Request.Form("txtName"))<>"" Then
If Request.form("remember") ="1" Then
Response.Cookies("ckName") = Request.Form("txtName")
Response.Cookies("ckURL") = Request.Form("txtURL")
Response.Cookies("ckEmail") = Request.Form("txtEmail")
Response.Cookies("ckRemember") = "1"
Response.Cookies("ckName").Expires = Date + 30
Response.Cookies("ckURL").Expires = Date + 30
Response.Cookies("ckEmail").Expires = Date + 30
Response.Cookies("ckRemember").expires = Date + 30
Else
Response.Cookies("ckName") = ""
Response.Cookies("ckURL") = ""
Response.Cookies("ckEmail") = ""
Response.Cookies("ckRemember") = ""
End If
End If
%>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "form1") Then
MM_editConnection = MM_blog_STRING
MM_editTable = "tblComment"
MM_editRedirectUrl = "thanks.asp"
MM_fieldsStr = "txtName|value|txtURL|value|txtEmail|value|textarea|value|hiddenField|value"
MM_columnsStr = "commentName|',none,''|commentURL|',none,''|commentEmail|',none,''|commentHTML|',none,''|blogID|none,none,NULL"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim rsComments__MMColParam
rsComments__MMColParam = "0"
If (Request("MM_EmptyValue") <> "") Then
rsComments__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsComments__MMColParam2
rsComments__MMColParam2 = "0"
If (Request.QueryString("id") <> "") Then
rsComments__MMColParam2 = Request.QueryString("id")
End If
%>
<%
Dim rsComments
Dim rsComments_numRows
Set rsComments = Server.CreateObject("ADODB.Recordset")
rsComments.ActiveConnection = MM_blog_STRING
rsComments.Source = "SELECT * FROM tblComment WHERE commentInclude <> " + Replace(rsComments__MMColParam, "'", "''") + " AND blogID = " + Replace(rsComments__MMColParam2, "'", "''") + " ORDER BY commentID ASC"
rsComments.CursorType = 0
rsComments.CursorLocation = 2
rsComments.LockType = 1
rsComments.Open()
rsComments_numRows = 0
%>
<%
Dim Repeat5__numRows
Dim Repeat5__index
Repeat5__numRows = -1
Repeat5__index = 0
rsComments_numRows = rsComments_numRows + Repeat5__numRows
%>
<%
Function MakeHyperlink(strSource)
if (strSource <> "") or Not IsNull(strSource) then
splitSource = Split(strSource," ")
linkResult = Filter(splitSource, "www", True)
emailResult = Filter(splitSource, "@", True)
For i = 0 to Ubound (splitSource)
MakeHyperLink = MakeHyperlink & splitSource(i) & " "
Next
For i = 0 to Ubound (linkResult)
If Right(linkResult(i),1) = "," OR Right(linkResult(i),1) = "." then
linkResult(i)=left(linkResult(i),len(linkResult(i))-1)
End If
If Left(linkResult(i),7) = "http://" OR Left(linkResult(i),7) = "HTTP://" then
linkWrapTag = "" & linkResult(i) & ""
Else
linkWrapTag = "" & linkResult(i) & ""
End If
MakeHyperLink = Replace(MakeHyperLink, linkResult(i), linkWrapTag)
Next
For i = 0 to Ubound (emailResult)
If Right(emailResult(i),1) = "," OR Right(emailResult(i),1) = "." then
emailResult(i)=left(emailResult(i),len(emailResult(i))-1)
End If
emailWrapTag = "" & emailResult(i) & ""
MakeHyperLink = Replace(MakeHyperLink, emailResult(i), emailWrapTag)
Next
MakeHyperLink = Replace(MakeHyperLink,Chr(13)," ")
Else
MakeHyperlink = strSource
End If
End Function
%>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
rsCats.MoveNext() %><%
Wend
%>
<% End If ' end Not rsCats.EOF Or NOT rsCats.BOF %>
<% If Not rsArchives.EOF Or Not rsArchives.BOF Then %>
Archives
<%
While ((Repeat2__numRows <> 0) AND (NOT rsArchives.EOF))
%>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
rsArchives.MoveNext() %>
<%
Wend
%>
<% End If ' end Not rsArchives.EOF Or NOT rsArchives.BOF %>
Recent Entries
<%
While ((Repeat4__numRows <> 0) AND (NOT rsRecent.EOF))
%>
Comments
<% While ((Repeat1__numRows <> 0) AND (NOT rsComments.EOF)) %> " id="<%=(rsComments.Fields.Item("commentID").Value)%>"> <% If Len(rsComments.Fields.Item("commentURL").Value) > 12 Then %>" title="Visit <%=(rsComments.Fields.Item("commentName").Value)%>'s Website"><%=(rsComments.Fields.Item("commentName").Value)%> said...
<% Else %><%=(rsComments.Fields.Item("commentName").Value)%> said...
<% End If %><%=MakeHyperlink(rsComments.Fields.Item("commentHTML").Value)%>
" title="Comment Permalink"><%=(rsComments.Fields.Item("commentDate").Value)%>
<% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 rsComments.MoveNext() Wend %>