%@ Language=VBScript %>
<% Option Explicit %>
<% Response.Buffer = True %>
<%
Dim gstrDatabaseType, gstrConnectToDatabase, gstrNewsDatabaseTemplatePage, gstrNewsDatabaseVirtualAddress, gstrNewsPostingPassword, gstrNewsAdminPassword
%>
<%
'********************************************
'* News Database By Smo *
'* Print File *
'* (c) 2001 By Tim Smulders *
'* Version 3 *
'* http://www.iamsmo.com *
'********************************************
'Dims
Dim objConn, gstrElsid, gstrComments, gstrFFType, gintFontSize, gstrDateAndTimeFormat
Response.Write "
Article Print"
gstrElsid = Session.LCID
Select Case Request.QueryString("pcmd")
Case "previewarticleprint"
previewarticleprint
Case "adminpreviewcommentprint"
adminpreviewcommentprint
Case "previewcommentprint"
previewcommentprint
Case "adminarticleprint"
adminarticleprint
Case "articleprint"
articleprint
Case "admincommentprint"
admincommentprint
Case "commentprint"
commentprint
Case Else
Response.Write "Please use the form when accessing this page!"
End Select
Response.Write ""
'*******************************************************************
'* Subroutines below... *
'*******************************************************************
'*******************************************************************
'* Subroutines to print preview article. *
'*******************************************************************
Sub previewarticleprint
Response.Write "" & Session("ArticleHeadline") & "
"
If Session("ArticleActive") = "OnThisDate" Then
Response.Write "[ " & Session("ArticleMonth") & "/" & Session("ArticleDay") & "/" & Session("ArticleYear") & " " & Session("ArticleHour") & ":00:00 " & Session("ArticleAMPM") & " ]"
Else
Response.Write "[ " & Session("ArticleDateAndTime") & " ]"
End If
Response.Write " By " & Session("ArticleAuthor") & " " & Session("ArticleAuthorEmail") & "
"
Response.Write Replace(Session("ArticleLeadIn"), vbCrLf, "
")
If Session("ArticleFull") <> "" Then
Response.Write "
"
Response.Write Replace(Session("ArticleFull"), vbCrLf, "
")
End If
End Sub
'*******************************************************************
'* Subroutines to print admin preview comment. *
'*******************************************************************
Sub adminpreviewcommentprint
Response.Write "" & Session("AdminAddArticleCommentHeading") & "
[ " & Session("AdminAddCommentDateAndTime") & " ] By " & Session("AdminAddCommentAuthor") & " " & Session("AdminAddCommentAuthorEmail") & "
"
Response.Write Replace(Session("AdminAddArticleComment"), vbCrLf, "
")
End Sub
'*******************************************************************
'* Subroutines to print preview comment. *
'*******************************************************************
Sub previewcommentprint
printgetoptions
Response.Write "" & Session("AddArticleCommentHeading") & "
[ " & FormatDateAndTime(Session("AddCommentDateAndTime")) & " ] By " & Session("AddCommentAuthor") & " " & Session("AddCommentAuthorEmail") & "
"
Response.Write "" & Replace(Session("AddArticleComment"), vbCrLf, "
") & ""
End Sub
'*******************************************************************
'* Subroutines to admin print article. *
'*******************************************************************
Sub adminarticleprint
checkadmin
Dim intAdminPrintArticleId, strArticleLeadInAdminPrintArticle, strArticleFullAdminPrintArticle
intAdminPrintArticleId = Request.QueryString("articleid")
If NOT IsNumeric(intAdminPrintArticleId) Then
Response.Write "Please use the form when accessing this page!"
Exit Sub
Else
intAdminPrintArticleId = Cint(intAdminPrintArticleId)
End If
'Create The SQL
Dim strSQLAdminPrintArticle
strSQLAdminPrintArticle = "SELECT ArticleId, ArticleAuthor, ArticleAuthorEmail, ArticleDateAndTime, ArticleHeadline, ArticleLeadIn, ArticleFull FROM tblNewsDatabaseBySmo WHERE ArticleId = " & intAdminPrintArticleId & ";"
'Open Connection
openconn
'Open Recordset
Dim objAdminPrintArticle
Set objAdminPrintArticle = Server.CreateObject("ADODB.Recordset")
objAdminPrintArticle.Open strSQLAdminPrintArticle, objConn, 0, 1
If objAdminPrintArticle.EOF Then
Response.Write "Please use the form when accessing this page!"
'Close Recordset
objAdminPrintArticle.Close
Set objAdminPrintArticle = Nothing
'Close Connection
closeconn
Exit Sub
Else
strArticleLeadInAdminPrintArticle = objAdminPrintArticle("ArticleLeadIn")
strArticleFullAdminPrintArticle = objAdminPrintArticle("ArticleFull")
Response.Write "" & objAdminPrintArticle("ArticleHeadline") & "
[ " & objAdminPrintArticle("ArticleDateAndTime") & " ] By " & objAdminPrintArticle("ArticleAuthor") & " " & objAdminPrintArticle("ArticleAuthorEmail") & "
"
Response.Write Replace(strArticleLeadInAdminPrintArticle, vbCrLf, "
")
If strArticleFullAdminPrintArticle <> "" Then
Response.Write "
"
Response.Write Replace(strArticleFullAdminPrintArticle, vbCrLf, "
")
End If
'Close Recordset
objAdminPrintArticle.Close
Set objAdminPrintArticle = Nothing
'Close Connection
closeconn
End If
End Sub
'*******************************************************************
'* Subroutines to print article. *
'*******************************************************************
Sub articleprint
printgetoptions
Dim intPrintArticleId, strArticleLeadInPrintArticle, strArticleFullPrintArticle
intPrintArticleId = Request.QueryString("articleid")
If NOT IsNumeric(intPrintArticleId) Then
Response.Write "Please use the form when accessing this page!"
Exit Sub
Else
intPrintArticleId = Cint(intPrintArticleId)
End If
'Create The SQL
Dim strSQLPrintArticle
Select Case gstrDatabaseType
Case "Access"
Session.LCID = 1033
strSQLPrintArticle = "SELECT ArticleId, ArticleAuthor, ArticleAuthorEmail, ArticleDateAndTime, ArticleHeadline, ArticleLeadIn, ArticleFull FROM tblNewsDatabaseBySmo WHERE DateDiff('s', Now(), ArticleDateAndTime) <= 0 AND ArticleId = " & intPrintArticleId & ";"
Session.LCID = gstrElsid
Case "SQLServer"
Session.LCID = 1033
strSQLPrintArticle = "SELECT ArticleId, ArticleAuthor, ArticleAuthorEmail, ArticleDateAndTime, ArticleHeadline, ArticleLeadIn, ArticleFull FROM tblNewsDatabaseBySmo WHERE DateDiff(s, GetDate(), ArticleDateAndTime) <= 0 AND ArticleId = " & intPrintArticleId & ";"
Session.LCID = gstrElsid
Case Else
Response.Clear
Response.Write "Administrator check database type."
Response.End
End Select
'Open Connection
openconn
'Open Recordset
Dim objPrintArticle
Set objPrintArticle = Server.CreateObject("ADODB.Recordset")
objPrintArticle.Open strSQLPrintArticle, objConn, 0, 1
If objPrintArticle.EOF Then
Response.Write "Please use the form when accessing this page!"
'Close Recordset
objPrintArticle.Close
Set objPrintArticle = Nothing
'Close Connection
closeconn
Exit Sub
Else
strArticleLeadInPrintArticle = objPrintArticle("ArticleLeadIn")
strArticleFullPrintArticle = objPrintArticle("ArticleFull")
Response.Write "" & objPrintArticle("ArticleHeadline") & "
[ " & FormatDateAndTime(objPrintArticle("ArticleDateAndTime")) & " ] From files at EVERYTHINGANGUS.COM
"
Response.Write "" & Replace(strArticleLeadInPrintArticle, vbCrLf, "
") & ""
If strArticleFullPrintArticle <> "" Then
Response.Write "
"
Response.Write "" & Replace(strArticleFullPrintArticle, vbCrLf, "
") & ""
End If
'Close Recordset
objPrintArticle.Close
Set objPrintArticle = Nothing
'Close Connection
closeconn
End If
End Sub
'*******************************************************************
'* Subroutines to admin print comment. *
'*******************************************************************
Sub admincommentprint
checkadmin
Dim intAdminPrintCommentId, strArticleCommentAdminPrintComment
intAdminPrintCommentId = Request.QueryString("commentid")
If NOT IsNumeric(intAdminPrintCommentId) Then
Response.Write "Please use the form when accessing this page!"
Exit Sub
Else
intAdminPrintCommentId = Cint(intAdminPrintCommentId)
End If
'Create The SQL
Dim strSQLAdminPrintComment
strSQLAdminPrintComment = "SELECT CommentId, ArticleId, CommentAuthor, CommentAuthorEmail, CommentDateAndTime, ArticleCommentHeading, ArticleComment FROM tblComments WHERE CommentId = " & intAdminPrintCommentId & ";"
'Open Connection
openconn
'Open Recordset
Dim objAdminPrintComment
Set objAdminPrintComment = Server.CreateObject("ADODB.Recordset")
objAdminPrintComment.Open strSQLAdminPrintComment, objConn, 0, 1
If objAdminPrintComment.EOF Then
Response.Write "Please use the form when accessing this page!"
'Close Recordset
objAdminPrintComment.Close
Set objAdminPrintComment = Nothing
'Close Connection
closeconn
Exit Sub
Else
strArticleCommentAdminPrintComment = objAdminPrintComment("ArticleComment")
Response.Write "" & objAdminPrintComment("ArticleCommentHeading") & "
[ " & objAdminPrintComment("CommentDateAndTime") & " ] By " & objAdminPrintComment("CommentAuthor") & " " & objAdminPrintComment("CommentAuthorEmail") & "
" & Replace(strArticleCommentAdminPrintComment, vbCrLf, "
")
'Close Recordset
objAdminPrintComment.Close
Set objAdminPrintComment = Nothing
'Close Connection
closeconn
End If
End Sub
'*******************************************************************
'* Subroutines to print comment. *
'*******************************************************************
Sub commentprint
printgetoptions
If gstrComments <> "Yes" Then
Response.Clear
Response.Write "You do not have permission to access this data."
Response.End
End If
Dim intPrintCommentId, strArticleCommentPrintComment
intPrintCommentId = Request.QueryString("commentid")
If NOT IsNumeric(intPrintCommentId) Then
Response.Write "Please use the form when accessing this page!"
Exit Sub
Else
intPrintCommentId = Cint(intPrintCommentId)
End If
'Create The SQL
Dim strSQLPrintComment
Select Case gstrDatabaseType
Case "Access"
Session.LCID = 1033
strSQLPrintComment = "SELECT tblComments.CommentId, tblComments.ArticleId, tblComments.CommentAuthor, tblComments.CommentAuthorEmail, tblComments.CommentDateAndTime, tblComments.ArticleCommentHeading, tblComments.ArticleComment, tblNewsDatabaseBySmo.ArticleDateAndTime FROM tblNewsDatabaseBySmo INNER JOIN tblComments ON tblNewsDatabaseBySmo.ArticleId = tblComments.ArticleId WHERE DateDiff('s', Now(), tblNewsDatabaseBySmo.ArticleDateAndTime) <= 0 AND tblComments.CommentId = " & intPrintCommentId & ";"
Session.LCID = gstrElsid
Case "SQLServer"
Session.LCID = 1033
strSQLPrintComment = "SELECT tblComments.CommentId, tblComments.ArticleId, tblComments.CommentAuthor, tblComments.CommentAuthorEmail, tblComments.CommentDateAndTime, tblComments.ArticleCommentHeading, tblComments.ArticleComment, tblNewsDatabaseBySmo.ArticleDateAndTime FROM tblNewsDatabaseBySmo INNER JOIN tblComments ON tblNewsDatabaseBySmo.ArticleId = tblComments.ArticleId WHERE DateDiff(s, GetDate(), tblNewsDatabaseBySmo.ArticleDateAndTime) <= 0 AND tblComments.CommentId = " & intPrintCommentId & ";"
Session.LCID = gstrElsid
Case Else
Response.Clear
Response.Write "Administrator check database type."
Response.End
End Select
'Open Connection
openconn
'Open Recordset
Dim objPrintComment
Set objPrintComment = Server.CreateObject("ADODB.Recordset")
objPrintComment.Open strSQLPrintComment, objConn, 0, 1
If objPrintComment.EOF Then
Response.Write "Please use the form when accessing this page!"
'Close Recordset
objPrintComment.Close
Set objPrintComment = Nothing
'Close Connection
closeconn
Exit Sub
Else
strArticleCommentPrintComment = objPrintComment("ArticleComment")
Response.Write "" & objPrintComment("ArticleCommentHeading") & "
[ " & FormatDateAndTime(objPrintComment("CommentDateAndTime")) & " ] By " & objPrintComment("CommentAuthor") & " " & objPrintComment("CommentAuthorEmail") & "
"
Response.Write "" & Replace(strArticleCommentPrintComment, vbCrLf, "
") & ""
'Close Recordset
objPrintComment.Close
Set objPrintComment = Nothing
'Close Connection
closeconn
End If
End Sub
'*******************************************************************
'* Subroutine to get options for print. *
'*******************************************************************
Sub printgetoptions
'Open Connection
openconn
'Open Recordset
Dim objPrintGetOptions
Set objPrintGetOptions = Server.CreateObject("ADODB.Recordset")
objPrintGetOptions.Open "tblNewsDatabaseBySmoOptions", objConn, 0, 1, 2
If objPrintGetOptions.EOF Then
'Close Recordset
objPrintGetOptions.Close
Set objPrintGetOptions = Nothing
'Close Connection
closeconn
Response.Clear
Response.Write "Error: Administrator reset options."
Response.End
Else
gstrComments = objPrintGetOptions("Comments")
gstrFFType = objPrintGetOptions("FFType")
gintFontSize = objPrintGetOptions("FontSize")
gstrDateAndTimeFormat = objPrintGetOptions("DateAndTimeFormat")
'Close Recordset
objPrintGetOptions.Close
Set objPrintGetOptions = Nothing
'Close Connection
closeconn
End If
End Sub
'*******************************************************************
'* Subroutine to check admin. *
'*******************************************************************
Sub checkadmin
If Session("CheckNewsDatabasePassword") <> gstrNewsAdminPassword Then
Response.Write "You do not have permission to use this page.