<%
Dim SpamProtect 'Protect Repeated Submit
If Session("SpamProtect")=Null Then
Session("SpamProtect")=False
End If
set conn=Server.CreateObject("ADODB.Connection")
str="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("WebboardDB.mdb")
Conn.Open str,"",""
set RS = Server.CreateObject("ADODB.Recordset")
sql="Select * From HEAD ORDER BY HeadID DESC"
RS.Open sql, Conn, 1, 3
NewHeadLine=Request.Form("HeadLine")
Name=request.Form("Name")
Email=Request.Form("Email")
DateTime=Date()
Message=Request.Form("Message")
if (NewHeadLine<>"" AND Session("SpamProtect")=False) then
RS.AddNew
RS("HeadLine")=NewHeadLine
RS("Name")=Name
RS("Email")=Email
RS("DateTime")=DateTime
RS("Detail")=Message
RS.Update
Session("SpamProtect")=True
end if
%>
<%
Dim icolor
icolor=1
While NOT RS.EOF%>
<%=RS("HeadID")%>
: <%=RS("Name")%> <%=RS("EMail")%>
: <%=ShowDate(RS("DateTime"))%>:
<%Rs.MoveNext
icolor=icolor+1
Wend
%>
<%
RS.Close
Conn.Close
Set RS=Nothing
Set Conn=Nothing
Function ShowDate(D)
Dim MonthNames
MonthNames=array ("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม")
ShowDate=Day(D)&" "&MonthNames(Month(D)-1)&" "&Year(D)
End Function
%>