<%@ LANGUAGE = "VBScript" %> <% Response.Buffer = false %> <% Dim bErrorsOnPage Dim dblQuote, city, country, surname, firstname, email, message Dim posDelimiter Dim bSurnameError, sFirstnameError dblQuote = Chr(34) bErrorsOnPage = False '*************************************************************************************** surname= request.Form("surname") If IsEmpty(surname) Or IsNull(surname) Or surname= "" Then bErrorsOnPage = True Session("surnameError") = "
* please enter your surname" End If firstname= request.Form("firstname") If IsEmpty(firstname) Or IsNull(firstname) Or firstname= "" Then bErrorsOnPage = True Session("firstnameError") = "
* please enter your first name" End If message= request.Form("message") If IsEmpty(message) Or IsNull(message) Or message= "" Then bErrorsOnPage = True Session("messageError") = "
* please enter a message in the guest book" End If email = request.Form("email") country = request.Form("country") city = request.Form("city") Session("firstname") = firstname Session("surname") = surname Session("email") = email Session("country") = country Session("city") = city Session("message") = message If bErrorsOnPage = True Then Session("submitResults") = "
* Please enter required fields and submit again" Else Dim currTimestamp currTimestamp = monthname(month(now)) & "-" & day(now) & "-" & year(now) & " " & time strSQL ="Delete from tblGuestbook WHERE " strSQL = strSQL & " firstname=" & Chr(34) & Trim(firstname) & Chr(34) strSQL = strSQL & " And surname=" & Chr(34) & Trim(surname) & Chr(34) On Error Resume Next con.Execute strSQL If err.number > 0 then If CStr(err.nativeerror) = "2013" or CInt(err.nativeerror) = 2013 Then con.Close Set con=nothing %> <% Else response.write "VBScript Errors Occured:" & "

" response.write "Error Number=" & err.number & "

" response.write "Error Descr.=" & err.description & "

" response.write "Help Context=" & err.helpcontext & "

" response.write "Help Path=" & err.helppath & "

" response.write "Native Error=" & err.nativeerror & "

" response.write "Source=" & err.source & "

" response.write "SQLState=" & err.sqlstate & "

" con.Close Set con=nothing End If Else strSQL ="Insert into tblGuestbook " strSQL = strSQL & "(surname, firstname, email, city, country, message, dateReply) " strSQL = strSQL & "values (" strSQL = strSQL & Chr(34) & Trim(surname) & Chr(34) & "," strSQL = strSQL & Chr(34) & Trim(firstname) & Chr(34) & "," strSQL = strSQL & Chr(34) & Trim(email) & Chr(34) & "," strSQL = strSQL & Chr(34) & Trim(city) & Chr(34) & "," strSQL = strSQL & Chr(34) & Trim(country) & Chr(34) & "," strSQL = strSQL & Chr(34) & Replace(message,Chr(34),"'") & Chr(34) & "," strSQL = strSQL & Chr(34) & currTimestamp & Chr(34) & ")" con.Execute strSQL If err.number > 0 then If CStr(err.nativeerror) = "2013" or CInt(err.nativeerror) = 2013 Then con.Close Set con=nothing %> <% Else response.write "VBScript Errors Occured:" & "

" response.write "Error Number=" & err.number & "

" response.write "Error Descr.=" & err.description & "

" response.write "Help Context=" & err.helpcontext & "

" response.write "Help Path=" & err.helppath & "

" response.write "Native Error=" & err.nativeerror & "

" response.write "Source=" & err.source & "

" response.write "SQLState=" & err.sqlstate & "

" con.Close Set con=nothing End If Else Session("submitResults") = "
Thank you. Your message has been forwarded to Marie-Josee and Mike!" con.Close Set con=nothing End If End If End If %>