<%@ Language = VBScript%> <% Option Explicit%> <% Response.Buffer = true%> Register with the Door Community Auditorium for Email Announcements <% dim strTitle strTitle="Register for Email Announcements" dim strPrompt(15) strPrompt(2)="First Name" strPrompt(3)="Last Name" strPrompt(4)="Email Address" strPrompt(5)="Street Address 1" strPrompt(6)="Street Address 2" strPrompt(7)="City" strPrompt(8)="State" strPrompt(9)="Zip Code" strPrompt(10)="Phone" dim strTableName strTableName="emailAddresses" 'Entry two in the table is key field from table 2 dim strEditorName strEditorName="addContact.asp" dim strOneItem strOneItem="Show" Function swap(intLoc, strIn, strNew, oldLength) Dim strOut strOut = Left(strIn, intLoc - 1) & strNew & Right(strIn, Len(strIn) - oldLength - intLoc + 1) swap = strOut End Function Function textParagraph(strIn ) Const conOpenPara = "

" Const conClosePara = "

" Const conLineBreak ="
" dim strEndLine strEndLine = vbNewLine & "" Dim strPara strPara = conOpenPara Dim intPos Dim strOut strOut = strIn intPos = InStr(1, strIn,strPara) Do While intPos > 0 if strPara = conOpenPara then strOut = swap(intPos, strOut, "", 3) else strOut = swap(intPos,strOut,strEndLine & strEndLine,4) end if If strPara = conOpenPara Then strPara = conClosePara Else strPara = conOpenPara End If intPos = InStr(intPos, strOut, strPara) Loop intPos = InStr(1,strOut,conLineBreak) Do While intPos > 0 strOut = swap(intPos,strOut,strEndLine,4) intPos = InStr(intPos, strOut, conLineBreak) Loop 'clear double quotes textParagraph = strOut End Function Function replaceQuotes(strIn ) Const conOpenQuote = "“" Const conCloseQuote = "”" Const conSingleQuote = "’" Dim strQuote strQuote = conOpenQuote Dim intPos Dim strOut if strIn = "" then strOut = " " else strOut = strIn intPos = InStr(1, strIn, """") Do While intPos > 0 strOut = swap(intPos, strOut, strQuote, 1) If strQuote = conOpenQuote Then strQuote = conCloseQuote Else strQuote = conOpenQuote End If intPos = InStr(intPos, strOut, """") Loop strQuote = conSingleQuote intPos = InStr(1, strIn, "'") Do While intPos > 0 strOut = swap(intPos, strOut, strQuote, 1) intPos = InStr(intPos, strOut, "'") Loop 'clear double quotes end if replaceQuotes = strOut End Function Function makeParagraphs(strIn) dim strEndLine,strEndPara strEndLine = vbNewLine & "" strEndPara = strEndLine & strEndLine dim intPos dim strOut strOut = replaceQuotes(strIn) intPos = InStr(1,strOut,strEndLine & strEndLine) 'response.write(intPos & "
") do while intPos >0 strOut=swap(intPos,strOut,"

",4) intPos = InStr(1,strOut,strEndLine & strEndLine) loop intPos = InStr(1,strOut,strEndLine) 'response.write(intPos & "
") do while intPos >0 strOut=swap(intPos,strOut,"
",2) intPos = InStr(1,strOut,strEndLine) loop 'response.write(strOut) 'response.end makeParagraphs=strOut End Function dim strUpdate strUpdate= request("update") & "" if strUpdate<>"" then end if dim strFieldName(50),intFieldType(50), intFieldSize(50) dim strFieldName2(50),intFieldType2(50), intFieldSize2(50) dim objField, intFieldCount,intFieldCount2,intCount intFieldCount=0 sql = "Select * From " & strTableName Call objRecordSet.Open( sql, objConnection, adOpenForwardOnly, adLockOptimistic, adCmdText) for each objField in objRecordSet.Fields intFieldCount=intFieldCount + 1 strFieldName(intFieldCount)=objField.Name intFieldType(intFieldCount)=objField.Type intFieldSize(intFieldCount)=objField.DefinedSize next objRecordSet.Close dim intRecordId intRecordId=request(strFieldName(1)) + 0 'response.write(Session("ThankYou")) 'response.end if Session("ThankYou") <>"" then response.redirect("../default.asp") end if if strUpdate="on" then 'update the database Session("Thankyou")="on" if intRecordId=0 then sql="Select * From " & strTableName & " where " & strFieldName(4) & " = '" & request(strFieldName(4)) & "';" Call objRecordSet.Open( sql, objConnection, adOpenForwardOnly, adLockOptimistic, adCmdText) if objRecordSet.eof then objRecordSet.AddNew objRecordSet(strFieldName(4))=request(strFieldName(4)) objRecordSet.Update end if intRecordId=objRecordSet.Fields(strFieldName(1)).value objRecordSet.Close end if sql = "Select * From " & strTableName & " where " & strFieldName(1) & "=" & intRecordId & ";" 'response.write(sql) Call objRecordSet.Open( sql, objConnection, adOpenForwardOnly, adLockOptimistic, adCmdText) for intCount=2 to intFieldCount-1 'last field is the active field. 'response.write(strFieldName(intCount)) if intFieldType(intCount)= 202 then ' text field objRecordSet(strFieldName(intCount))=replaceQuotes(request(strFieldName(intCount))) elseif intFieldType(intCount)=203 Or intFieldType(intCount)=202 then objRecordSet(strFieldName(intCount))=makeParagraphs(request(strFieldName(intCount))) elseif intFieldType(intCount)=11 then objRecordSet(strFieldName(intCount))=(request(strFieldName(intCount))="on") elseif intFieldType(intCount)=7 then objRecordSet(strFieldName(intCount))=DateValue(request(strFieldName(intCount))) else objRecordSet(strFieldName(intCount))=request(strFieldName(intCount)) end if next objRecordSet.Update dim strCustomerEmail strCustomerEmail=objRecordSet("EmailAddress") objRecordSet.Close end if 'dim temp 'for temp = 1 to intFieldCount ' response.write(strFieldName(temp) & " " & intFieldType(temp) & "
") 'next 'response.end %>



<% if session("Thankyou")<>"" then%>

Thank you for registering for our email service.

<% dim strMailFrom, strMailTo, strSubject,strTest ' What address does the mail come from? The Box Office strMailFrom = Application("EmailAddress") ' Who gets this email? strMailTo = strCustomerEmail ' Subject of the submitted message that comes to you strSubject = "Registration for Door Community Auditorium email notices complete" dim strMessage strMessage = "Your name has been added to the email list for the Door Community Auditorium" strTest=strMessage dim objMessage if Application("Email") then Set objMessage = CreateObject("CDONTS.Newmail") objMessage.Subject = strSubject & " (" & intRecordId & ")" objMessage.From = strMailFrom objMessage.To = strMailTo objMessage.Body = strMessage objMessage.Send objMessage=nothing end if else%>

Register for Email Announcements from the Door Community Auditorium

<% for intCount=2 to intFieldCount-1%> <%elseif intFieldType(intCount)=203 then%> <% elseif intFieldType(intCount)=11 then%> <% elseif intFieldType(intCount)=6 then%> <%=strPrompt(intCount)%> <% elseif intFieldType(intCount)=7 then%> <%=strPrompt(intCount)%> <% else%> <%=strPrompt(intCount)%> <% end if%> <% next%>
<%=strPrompt(intCount)%>  <% if intFieldType(intCount)= 202 then ' text field%>




<% end if%>