|
hyBook - A Simple Guestbook Application
Part:
1
2
3
4
5
6
7
8
9
10
11
12
13
(Continued from previous part...)
Sub outputBody
If sgError <> "" Then
htmlError(sgError)
sgError = ""
End If
If sgNotice <> "" Then
htmlNotice(sgNotice)
sgNotice = ""
End If
If bgShowTopic Then
htmlTopic(ngTopicID)
End If
If bgShowCommentList Then
htmlCommentList(ngTopicID)
End If
If bgShowCommentNew Then
htmlCommentNew(ngTopicID)
End If
End Sub
Sub outputFooter
' Do nothing
End Sub
Sub closing
dbClose
End Sub
Function htmlTopic(ngTopicID)
Set rsTopic = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT * FROM hyTopic WHERE ID=" & ngTopicID
If bgDebug Then
ogDebug.WriteLine(sSQL)
End If
rsTopic.Open sSQL, ogConn
If NOT rsTopic.EOF Then
Response.Write("<table class=hy_topic cellspacing=0" _
& " cellpadding=5><tr class=hy_topic_subject><td>")
Response.Write(rsTopic("Subject"))
Response.Write("</td></tr><tr class=hy_topic_content><td>")
Response.Write(replace(rsTopic("Content"), vbcrlf, "<br>"))
Response.Write("</td></tr></table>")
Else
htmlError("Invalid input data. Please return to home page.")
bgShowCommentList = False
bgShowCommentNew = False
End If
set rsTopic = Nothing
End Function
Function htmlCommentNew(ngTopicID)
Response.Write("<table class=hy_comment cellspacing=0" _
& " cellpadding=5>")
Response.Write("<form action=" _
& Request.ServerVariables("SCRIPT_NAME") & " method=post>")
Response.Write("<input type=hidden name=TopicID" _
& " value=""" & ngTopicID & """>")
Response.Write("<tr><td class=hy_comment_label>Your Name:</td>" _
& "<td><input type=text size=40 maxlength=40 name=Name" _
& " value=""" & sgName & """>(Req.)</td></tr>")
Response.Write("<tr><td class=hy_comment_label>Your E-mail:</td>" _
& "<td><input type=text size=40 maxlength=40 name=Email" _
& " value=""" & sgEmail & """>(Opt.)</td></tr>")
Response.Write("<tr><td class=hy_comment_label>Comment:</td>" _
& "<td><textarea name=Content cols=45 rows=10 wrap=virtual>" _
& sgContent & "</textarea>(Req.)</td></tr>")
Response.Write("<tr><td></td>" _
& "<td><input name=submit value=Submit type=submit><br>" _
& "Note that your email is only for Webmaster use only." _
& " It will not be displayed.</td></tr>")
Response.Write("</form>")
Response.Write("</table>")
End Function
Function removeHTML(strText)
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern = "<[^>]*>"
RegEx.Global = True
RemoveHTML = RegEx.Replace(strText, "")
End Function
(Continued on next part...)
Part:
1
2
3
4
5
6
7
8
9
10
11
12
13
|