Source Code for http://194.8.136.102/guestbook/addentry.asp

COLOR LEGEND
Server Side Script
Client Side Script
Hyperlink
Include
Frames
Comments
Object Code Link
Standard HTML and Text


<%@ LANGUAGE="VBScript" %>
<HTML>
<HEAD>
<TITLE>Guestbook entry</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">

<%  If (0 = Request.ServerVariables("CONTENT_LENGTH")) Then %>

<CENTER>
<H1>Sign in</H1>
<TABLE BORDER=0 WIDTH=550>
<TR><TD>

<FORM ACTION="<%=Request.ServerVariables("SCRIPT_NAME")%>" method=post>
<CENTER>
<TABLE BORDER=0 ALIGN=CENTER>
<TR>
<TH BGCOLOR="#eeeeee" ALIGN=LEFT>Your name</TH>
<TD><INPUT TYPE="text" SIZE=40 NAME="Name"></TD></TR>
<TR>
<TH BGCOLOR="#eeeeee" ALIGN=LEFT>E-mail address</TH>
<TD><INPUT TYPE="text" SIZE=40 NAME="EMAddr" VALUE="noemail@noemail.at"></TD></TR>
<TR>
<TR>
<TH BGCOLOR="#eeeeee" ALIGN=LEFT>The information presented on our pages is</TH>
<TD><SELECT NAME="IMark"><OPTION>Fantastic<OPTION>Wonderful
<OPTION>Interesting<OPTION>Boring<OPTION>Don´t know</SELECT></TD></TR>
<TR>
<TH BGCOLOR="#eeeeee" ALIGN=LEFT>The graphical layout/design of our pages is</TH>
<TD><SELECT NAME="GMark" WIDTH=35><OPTION>Wonderful<OPTION>Nice
<OPTION>Fair<OPTION>Ugly<OPTION>Don´t know</SELECT></TD></TR>
<TR>
<TH BGCOLOR="#eeeeee" ALIGN=LEFT VALIGN=TOP>Notes, comments or whatever comes across your mind... </TH>
<TD><TEXTAREA NAME="Notes" ROWS=5 COLS=50></TEXTAREA></TD></TR>
<TR>
<TD></TD>
<TD>
<INPUT TYPE="submit" VALUE="Sign in">
<INPUT TYPE="reset" VALUE="Clear">
</TD></TR>
<TR><TD></TD><TD><HR></TD></TR>
</TABLE>
</FORM>

</TD></TR></TABLE>

</CENTER>

<%  Else ' we got content

strName = Trim(Request("Name"))
strEMAddr = Trim(Request("EMAddr"))
strIMark = Trim(Request("IMark"))
strGMark = Trim(Request("GMark"))
strNotes = Trim(Request("Notes"))

strErrorString=""

If Not Len(strNotes) > 0 Then strNotes="()"

If Not Len(strName) > 0 Then strErrorString= "(Guest´s name missing)<BR>"
If Not Len(strEMAddr) > 0 Then strErrorString = strErrorString & "(Invalid e-mail address)"

If Not "" = strErrorString Then
%>


<H1>Guestbook entry rejected</H1>
Sorry, but your guestbook entry could not be accepted. You didn&#180;t provide
all information:
<P>
<B><%=strErrorString%></B>
<P>
Please use the <B>Back</B> button of your browser to go back and supply the missing information.


<%  Else
   ' no error was generated
   If ("finalinsert" = Request("DoInsertFinally")) Then
     ' generate sql insert string for this entry to the guestbook
     '
     sql = "INSERT INTO tGuestbook(DateEntered,Host,Browser,Name,EMAddr,IMark,GMark,Notes) "
     sql = sql & "VALUES( "
     sql = sql & "{fn now()},"
     sql = sql & "'"  & Request.ServerVariables("REMOTE_ADDR") & "',"
     sql = sql & "'"  & Request.ServerVariables("HTTP_USER_AGENT") & "',"

     sql = sql & "'"  & Replace(strName,"'","''") & "',"
     sql = sql & "'"  & Replace(strEMAddr,"'","''") & "',"
     sql = sql & "'"  & Replace(strIMark,"'","''") & "',"
     sql = sql & "'"  & Replace(strGMark,"'","''") & "',"
     sql = sql & "'"  & Replace(strNotes,"'","''") & "')"

     Set DataConn = Server.CreateObject("ADODB.Connection")
     DataConn.Open "softwing"
     Set cmdTemp = Server.CreateObject("ADODB.Command")
     cmdTemp.CommandText = sql
     cmdTemp.CommandType = 1
     Set cmdTemp.ActiveConnection = DataConn
     cmdTemp.Execute
     Set cmdTemp = Nothing
     Set DataConn = Nothing
%>


<H1>Guestbook entry inserted!</H1>
Thank you for your entry, <%=strName%>. Your entry:<P>

<CENTER>
<TABLE BORDER=0>
<TR><TH ALIGN=LEFT>Name</TH><TD><%=strName%></TD></TR>
<TR><TH ALIGN=LEFT>E-mail</TH><TD><A HREF="mailto:<%=strEMAddr%>"><%=strEMAddr%></A></TD></TR>
<TR><TH VALIGN=TOP ALIGN=LEFT>Information</TH><TD><%=strIMark%></TD></TR>
<TR><TH VALIGN=TOP ALIGN=LEFT>Layout</TH><TD><%=strGMark%></TD></TR>
<TR><TH VALIGN=TOP ALIGN=LEFT>Notes</TH><TD><%=strNotes%></TD></TR>
</TABLE>

<% 
   Else ' the actiontype was not set, prove validate
%>


<H1>Verify Guestbook entry before final submission!</H1>
Your entry looks like presented below:<P>

<CENTER>
<TABLE BORDER=0>
<TR><TH ALIGN=LEFT>Name</TH><TD><%=strName%></TD></TR>
<TR><TH ALIGN=LEFT>E-mail</TH><TD><A HREF="mailto:<%=strEMAddr%>"><%=strEMAddr%></A></TD></TR>
<TR><TH VALIGN=TOP ALIGN=LEFT>Information</TH><TD><%=strIMark%></TD></TR>
<TR><TH VALIGN=TOP ALIGN=LEFT>Layout</TH><TD><%=strGMark%></TD></TR>
<TR><TH VALIGN=TOP ALIGN=LEFT>Notes</TH><TD><%=strNotes%></TD></TR>
</TABLE>

<P ALIGN=LEFT>If all this is correct, then please click on <B>Submit Entry</B>,
to finally enter your entry in the guest book. If you want to change the information you have
entered, then please use the <B>Back</B> button of your browser.</P>

<FORM METHOD=POST ACTION="<%=Request.ServerVariables("SCRIPT_NAME")%>">
<INPUT TYPE=HIDDEN NAME="DoInsertFinally" VALUE="finalinsert">
<INPUT TYPE=HIDDEN NAME="Name" VALUE="<%=strName%>">
<INPUT TYPE=HIDDEN NAME="EMAddr" VALUE="<%=strEMAddr%>">
<INPUT TYPE=HIDDEN NAME="IMark" VALUE="<%=strIMark%>">
<INPUT TYPE=HIDDEN NAME="GMark" VALUE="<%=strGMark%>">
<INPUT TYPE=HIDDEN NAME="Notes" VALUE="<%=strNotes%>">
<INPUT TYPE="submit" VALUE="Submit entry!">
</FORM>

<%
   End If ' insert now commited
   End If ' error string validation
End If ' end of content validation
%>


 <P>
<A HREF="/main.asp">Back</A> to softwing.com main page<P>

</BODY>
</HTML>