%@ LANGUAGE="VBScript" %>
<%
Set objSSData = Server.CreateObject("ADODataServer.clsADO20")
DSN = "LAGB"
If Len(Request.Form) > 0 then
' ONLY ALLOW GUESTBOOK ENTRIES
' Fill out the complete URL of the valid addguest.asp page for this website
OnlyValidReferrer = "http://www.maggiemceleney.com/"
strReferer = Request.ServerVariables("HTTP_REFERER")
If instr(1, strReferer,OnlyValidReferrer) <=0 Then
' redirect to valid input page
'Response.Write "strReferer = " & strReferer & "
" & vbCrLf
'Response.Write "OnlyValidReferrer = " & OnlyValidReferrer & "
" & vbCrLf
'Response.End
Response.Redirect OnlyValidReferrer
End if
guestname = SQLEncode(Request("guestname"))
email = SQLEncode(Request("email"))
url = SQLEncode(Request("url"))
city= SQLEncode(Request("city"))
state = SQLEncode(Request("state"))
country= SQLEncode(Request("country"))
comment = SQLEncode(Request("comment"))
postdate = CDate(Now())
if Trim(url) = "http://www." then
url = ""
end if
SQLStmt = "INSERT INTO ggguest_tb "
SQLStmt = SQLStmt & "(name, email, url, city, state, country, comment, postdate) "
SQLStmt = SQLStmt & "VALUES ("
SQLStmt = SQLStmt & "'" & guestname & "', '" & email & "', '" & url & "', "
SQLStmt = SQLStmt & "'" & city & "', '" & state & "', '" & country & "', "
SQLStmt = SQLStmt & "'" & comment & "', '" & postdate & "');"
%>
<%
vResult = objSSData.ProcessSQLExecuteStatement(DSN, SQLStmt)
if vResult <> 0 then %>
Error: <%= objSSData.ErrorCode %>
Desc: <%= objSSData.ErrorDescription %>
<% if DebugMsgVis = True then %>
SQL: <% = SQL %>
<% end if %>
<% elseif DebugMsgVis = True then %>
SQL: <% = SQL %>
<% end if %>
<% End if %>
<%
nameIdx = 0
emailIdx = 1
urlIdx = 2
cityIdx = 3
stateIdx = 4
countryIdx = 5
postdateIdx = 6
commentIdx = 7
SQLStmt = "SELECT name, email, url, city, state, country, postdate, comment FROM ggguest_tb order by postdate desc"
vResult = objSSData.ProcessSQLSelectStatement(DSN, SQLStmt, vdata, vhdr, vrowcnt, vcolcnt, vremaining)
%>
<% if vResult <> 0 then %>
Error: <%= objSSData.ErrorCode %>
Desc: <%= objSSData.ErrorDescription %>
<% if DebugMsgVis = True then %>
SQL: <% = SQL %>
<% end if %>
<% elseif DebugMsgVis = True then %>
SQL: <% = SQL %>
Rows: <%= vrowcnt %>
Cols: <%= vcolcnt %>
<% end if %>