"
response.write "
You must enter Email."
response.write "
"
response.end
Else
Country = request.form("Email")
End If
Email = request.form("Email")
If request.form("URL")="http://" then
URL = ""
Else
URL = request.form("URL")
End If
If IsEmpty(request.form("Comments")) or request.form("Comments")="" or request.form("Comments")=" " then
response.write ""
response.write "
Don't forget to enter your product details!"
response.write "
"
response.end
Else
Comments = request.form("Comments")
Comments = Replace(Comments, Chr(34), "''")
Comments = Replace(Comments, vbCrLf, "
")
End If
Flag = request.form("Flag")
%>
Here is the information you're submitting. If you would like to
make changes, please use the appropriate button below, or use the other
button to submit this entry as it is.
Name: <%= Name %>
City: <%= City %>
Tel No: <%= State %>
Email: <%= Email %>
URL: <%= URL %>
Product Details: <%= Comments %>
|
<%
End If
If Flag = 2 then
Today = Now()
Name = request.form("Name")
Name = Replace(Name, "'", "''")
Name = Replace(Name, Chr(34), "''")
City = request.form("City")
City = Replace(City, "'", "''")
State = request.form("State")
Country = request.form("Country")
Country = Replace(Country, "'", "''")
Email = request.form("Email")
URL = request.form("URL")
Comments = request.form("Comments")
Comments = Replace(Comments, "'", "''")
' ok now we've got our data so let's ship it off to the database
set conn = server.createobject("adodb.connection")
' **** change DSN name if you're using a DSN and you've named it differently
'conn.open "guestbook"
' **** DSN-less connection: comment out above line and uncomment the
' **** Code between "Begin" and "End"
' **** BEGIN DSN-LESS CONNECTION CODE
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("guestbook.mdb")
conn.Open DSNtemp
' **** END OF DSN-LESS CONNECTION CODE
' **** Note: If using a DSN-less connection, make sure to change server.mappath above to
' **** reflect the actual location of the guestbook database file.
' **** The above will work if the database file is at the webserver root.
' **** See readme.txt for further information
' **** the following line would be used ONLY if you use a system DSN!
' conn.Open "guestbook"
SQLstmt = "INSERT INTO Guestbook (Name,City,State,Country,Email,URL,Comments)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & Name & "',"
SQLstmt = SQLstmt & "'" & City & "',"
SQLstmt = SQLstmt & "'" & State & "',"
SQLstmt = SQLstmt & "'" & Country & "',"
SQLstmt = SQLstmt & "'" & Email & "',"
SQLstmt = SQLstmt & "'" & URL & "',"
SQLstmt = SQLstmt & "'" & Comments & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)
If err.number>0 then
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 & "
"
end if
IF conn.errors.count> 0 then
response.write "Database Errors Occured" & "
"
response.write SQLstmt & "
"
for counter= 0 to conn.errors.count
response.write "Error #" & conn.errors(counter).number & "
"
response.write "Error desc. -> " & conn.errors(counter).description & "
"
next
else
response.write "
"
response.write "Thank you! Your entry has been added.
"
response.write ""
response.write "View Guestbook"
end if
Conn.Close
Set conn = nothing
' *****************************************************************
' The following section of code sends email to the guestbook owner
' when somebody signs the guestbook. If you don't want this feature,
' just remove this block. Please note that this will ONLY work on
' NT SERVER with built-in SMTP!! On other systems, please see
' http://www.attitude.com/users/kathi/asp/tools.html for a list of
' components, including email components
' ******************************************************************
Set Mail = CreateObject("CDONTS.Newmail")
' get the sender's address, and if empty, put your own
If request("email")="" then
Sender = "info@web-savant.com" ' put your email address here
Else
Sender = request("email")
End If
Mail.From = Sender
Mail.To = "you@yourdomain.com" ' put YOUR email address here
Mail.Subject = "New Guestbook Entry" ' you can change this to whatever you'd like
Msg = "Name: " & request("name") & Chr(10)
Msg = Msg & "City: " & request("city") & Chr(10)
Msg = Msg & "State: " & request("State") & Chr(10)
Msg = Msg & "Country: " & request("Country") & Chr(10)
Msg = Msg & "URL: " & URL & Chr(10)
Msg = Msg & "Comments:" & Chr(10)
Msg = Msg & request("Comments")
Mail.Body = Msg
Mail.Send
Set Mail = Nothing
End If
%>