<%@ language="VBSCRIPT" codepage="65001" %> <% option Explicit response.Expires =0 'minutes session.Timeout =1200 'minutes %> <% dim EmailBody,ErrMsg,ErrMsg0(5),ReadFormDataErr dim nopersons,ContactId(5),RegDate,position(5),attention(5),title(5) dim seminarid,seminartext,totalfees,strdays,strworkshop,seminarcost dim firstname(5),lastname(5),company(5),pobox(5),city(5),country(5) dim tel_ext(5),tel(5),mobile_ext(5),mobile(5),fax_ext(5),fax(5),email(5),website(5) dim RegNo(5),payment(5),RecordWasSavedInDb(5) dim strday1,strday2,personNo,i,gotopayment dim StrSelectDinner(5),StrDinnerType(5),StrDinnerMenu(5) 'on error resume next nopersons="1" session("nopersons")=nopersons ErrMsg="" ReadFormDataErr=false for i=1 to nopersons attention(i)=Trim(cstr(Request.Form("firstname" & i))) & " " & Trim(cstr(Request.Form("lastname" & i))) call Replace2Quotesbyone(attention(i)) title(i)=Trim(cstr(Request.Form("title" & i))) if title(i)="Please select" then title(i)="" ErrMsg0(i)="" RecordWasSavedInDb(i)=false next 'If Request.ServerVariables("CONTENT_LENGTH") <> 0 Then ReadFormData if ErrMsg = "" then ReadFormDataErr=false else ErrMsg0(0)=ErrMsg end if for i=1 to nopersons personNo=i ErrMsg="" RecordWasSavedInDb(i)=SaveRecordInDb() if ErrMsg = "" then 'SendEmail else ErrMsg0(i)=ErrMsg end if next '============================== ErrMsg="" if ReadFormDataErr=false then ErrMsg=ErrMsg0(0) & "
" gotopayment=true for i=1 to nopersons ErrMsg=ErrMsg & ErrMsg0(i) & "
" if RecordWasSavedInDb(i)=false then gotopayment=false next if strday1="1" then if gotopayment=true then SendEmail response.Redirect("payment_T_C.asp") End if end if End if '========================= ShowFormResult '-------------------- Start Here --------------------------------------- Sub ShowFormResult%> Safety Design in Buildings

Registration Process

<%Response.Write EmailBody%>

<%end sub Sub Replace2Quotesbyone(MyStr) MyStr = Replace(MyStr, "''", "'") End Sub Sub CheckValid(MyStr) MyStr = Replace(MyStr, "'", "''") If MyStr = "" THEN MyStr = " " End If End Sub ' Function ReadFormData() ' 'on error resume next '----------regday code-------------- '111-twodays,010-day1,011-day1-2,001-day2 '----------regday code-------------- '----------workshop code-------------- 'Full,ws0,ws1,ws2,ws3 '----------workshop code-------------- ReadFormData=false seminarid=cint(Request.Form("seminarid")) session("seminarid")=seminarid seminartext=Trim(cstr(Request.Form("seminartext"))) session("seminartext")=seminartext strdays="000" strworkshop="" strday1="0" strday2="0" seminarcost="0" totalfees="0" if Trim(Request.Form("regday"))="day1" then strday1="1" strworkshop="Credit Card" end if if Trim(Request.Form("regday"))="day2" then strday2="1" strworkshop="Bank Transfer" end if strdays="0" & strday1 & strday2 if strday1="1" then seminarcost="265" '210 if strday2="1" then seminarcost="280" '225 session("seminarcost")=seminarcost totalfees=cint(seminarcost)* nopersons session("totalfees")=totalfees for i=1 to nopersons firstname(i)=Trim(cstr(Request.Form("firstname" & i))) lastname(i)=Trim(cstr(Request.Form("lastname" & i))) company(i)=Trim(cstr(Request.Form("company" & i))) position(i)=Trim(cstr(Request.Form("position" & i))) pobox(i)=Trim(cstr(Request.Form("pobox" & i))) city(i)=Trim(cstr(Request.Form("city" & i))) country(i)=Trim(cstr(Request.Form("country" & i))) tel_ext(i)=Trim(cstr(Request.Form("tel_ext" & i))) tel(i)=Trim(cstr(Request.Form("tel" & i))) mobile_ext(i)=Trim(cstr(Request.Form("mobile_ext" & i))) mobile(i)=Trim(cstr(Request.Form("mobile" & i))) fax_ext(i)=Trim(cstr(Request.Form("fax_ext" & i))) fax(i)=Trim(cstr(Request.Form("fax" & i))) email(i)=Trim(cstr(Request.Form("email" & i))) website(i)=Trim(cstr(Request.Form("website" & i))) StrSelectDinner(i)=Trim(cstr(Request.Form("StrYes" & i))) StrDinnerType(i)=Trim(cstr(Request.Form("DinnerType" & i))) StrDinnerMenu(i)=Trim(cstr(Request.Form("OptDinner" & i))) session("email" & i)=email(i) 'response.Write(StrSelectDinner(i) & StrDinnerType(i) & StrDinnerMenu(i)) next if err.number <>0 then ErrMsg="We are sorry, some errors occur during proccessing your request, please try again later.(reading)" exit function end if ReadFormData=true 'Response.Write "firstname= " & firstname end Function Function SaveRecordInDb() dim objConn,StrConn,objRS,strQ,StrEmailFound,AddNewContact 'on error resume next StrEmailFound="0" SaveRecordInDb=false RegNo(personNo)=0 payment(personNo)="No" RegDate=right("00" & day(date()),2) & "." & right("00" & month(date()),2) & "." & right("0000" & year(date()),4) Set objConn = Server.CreateObject("ADODB.Connection") StrConn="Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & server.MapPath("data/maillist.mdb") & ";" StrConn=StrConn & "Jet OLEDB:Database Password=123" objConn.Open StrConn 'Check if Email Already in our contacts table SET objRS=Server.CreateObject("ADODB.Recordset") objRS.CursorLocation =aduseserver objRS.CursorType = adopenkeyset objRS.LockType =adlockoptimistic strQ="select * from contacts" strQ=strQ & " where ucase(email)='" & ucase(email(personNo)) & "'" strQ=strQ & " and ucase(firstname)='" & ucase(firstname(personNo)) & "'" strQ=strQ & " and ucase(lastname)='" & ucase(lastname(personNo)) & "';" objRS.Open strQ, objConn, , ,adCmdText if objRS.EOF then 'case the person is not found in contacts table objRS.Close 'Add a record in the contacts table ContactId(personNo)=1 strQ="select max(id) as maxid from contacts" objRS.Open strQ, objConn, , ,adCmdText if not objRS.EOF then if not isnull(objRS("maxid")) then ContactId(personNo)=objRS("maxid")+1 end if objRS.Close objRS.Open "contacts" ,objConn, , ,adCmdTable ' objRS.AddNew objRS("id")=cint(ContactId(personNo)) else 'case the person is found in contacts table StrEmailFound="1" ContactId(personNo)= objRS("id") end if session("ContactId" & personNo)=cint(ContactId(personNo)) 'Response.Write(session("ContactId" & personNo)) 'response.End() objRS("title")=title(personNo) objRS("firstname")=firstname(personNo) objRS("lastname")=lastname(personNo) objRS("attention")=attention(personNo) objRS("company")=company(personNo) objRS("jobtitle")=position(personNo) objRS("pobox")=pobox(personNo) objRS("city")=city(personNo) objRS("country")=country(personNo) objRS("tel_ext")=tel_ext(personNo) objRS("tel_ext2")="" objRS("tel")=tel(personNo) objRS("mobile_ext")=mobile_ext(personNo) objRS("mobile_ext2")="" objRS("mobile")=mobile(personNo) objRS("fax_ext")=fax_ext(personNo) objRS("fax_ext2")="" objRS("fax")=fax(personNo) objRS("email")=email(personNo) objRS("website")=website(personNo) objRS("zippostalcode")="" objRS("middlename")="" objRS("keyword")="" objRS("address")="" objRS("businesstype")="" objRS("regfrom")=1 objRS("notifyme")="" objRS("sendmessage")="" objRS("areas_of_interest")="" objRS("no_of_employees")="" objRS("other_gcc")="" objRS("level")="1" objRS("username")=firstname(personNo) objRS("groupid")=seminarid objRS("password")=email(personNo) objRS("RegDate")=RegDate ' objRS("SelectDinner")=StrSelectDinner(personNo) ' objRS("DinnerType")=StrDinnerType(personNo) ' objRS("DinnerMenu")=StrDinnerMenu(personNo) objRS.Update objRS.Close ' AddNewContact=true if StrEmailFound="1" then strQ="select * from seminars_attend" strQ=strQ & " where seminarid=" & seminarid strQ=strQ & " and contactid=" & ContactId(personNo) & ";" objRS.Open strQ, objConn, , ,adCmdText if not objRS.EOF then AddNewContact=false 'case the person is registered for this event read regno + payment status if not isnull(objRS("regno")) then RegNo(personNo)=objRS("regno") session("regno" & personNo)=RegNo(personNo) if not isnull(objRS("payment")) then payment(personNo)=objRS("payment") if payment(personNo)="No" then PrepareEmailBody_Registered end if objRS.Close end if if AddNewContact=false then 'case the person is registered for this event set objRS = nothing objConn.Close set objConn = nothing 'msg if payment(personNo)="Yes" then ErrMsg= title(personNo) & " " & attention(personNo) & " already registered and paid for this event." else SaveRecordInDb=true end if exit function else 'case the person is not registered for this event RegNo(personNo)=1 strQ="select max(regno) as maxregno from seminars_attend where seminarid=" & seminarid & ";" objRS.Open strQ, objConn, , ,adCmdText if not objRS.EOF then if not isnull(objRS("maxregno")) then RegNo(personNo)=objRS("maxregno") + 1 end if if RegNo(personNo)<31 then RegNo(personNo)=51 objRS.close objRS.Open "seminars_attend" ,objConn, , ,adCmdTable objRS.AddNew objRS("contactid")=cint(ContactId(personNo)) objRS("seminarid")=cint(seminarid) objRS("regno")= cint(RegNo(personNo)) session("regno" & personNo)=cint(RegNo(personNo)) if strworkshop= "Credit Card" then PrepareEmailBody_CreditCard else PrepareEmailBody_BankTransfer end if if personNo=1 then objRS("nopersons")=cint(nopersons) objRS("totalfees")=cint(totalfees) else objRS("nopersons")=1 objRS("totalfees")=0 end if if nopersons>1 then objRS("regtype")=RegNo(1) 'put in regtype the 1st Regno of the person in case he registered more tha one person else objRS("regtype")="" 'put in regtype the 1st Regno of the person in case he registered more tha one person end if objRS("payment")="No" objRS("days")=strdays objRS("workshop")=strworkshop objRS("onetoone_m")=0 objRS("certificate")="" objRS("hearaboutevent")="" objRS("nwlounge")="" objRS("cv")="" objRS("RegDate")=RegDate objRS.Update objRS.close end if set objRS =nothing objConn.Close set objConn = nothing 'Response.Write(err.number & " " & err.description) if err.number <>0 then Response.Write ErrMsg ' ErrMsg="We are sorry, some errors occur during proccessing your request, please try again later.(saving in DB)" exit function end if SaveRecordInDb=true end Function Function SendEmail() dim objNewMail,StrEmailSubject,strBody 'on error resume next SendEmail=false StrEmailSubject= seminartext strBody = "" & EmailBody & "" ' Set objNewMail = Server.CreateObject("CDONTS.NewMail") Set objNewMail = CreateObject("CDO.Message") objNewMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objNewMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.palm.arvixe.com" objNewMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objNewMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False objNewMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 objNewMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 objNewMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "info@safetydesigninbuildings.com" objNewMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Infosu1234" objNewMail.Configuration.Fields.Update objNewMail.From = "info@safetydesigninbuildings.com" objNewMail.To = email(personNo) '"mohamed.m.demahom@gmail.com"marleen@sesam-uae.com 'objNewMail.cc= "anil@sesam-uae.com" objNewMail.cc= "marleen@sesam-uae.com,anil@sesam-uae.com,philipp@sesam-uae.com" objNewMail.Subject = seminartext ' objNewMail.Bodyformat =0 ' objNewMail.mailformat=0 objNewMail.HTMLBody = strBody 'Response.Write(err.number) 'response.End() objNewMail.Send Set objNewMail = Nothing if err.number <>0 then response.Write err.number & " " & err.Description response.End() end if 'if err.number <>0 then ' ErrMsg="Sorry, Some error occur in sending Email process, please try again later." ' exit function 'end if SendEmail=true End Function sub PrepareEmailBody_BankTransfer() EmailBody="Thank you " & title(personNo) & " " & attention(personNo) & ",

" EmailBody=EmailBody & "We received your registration details for the Safety Design in Buildings Kuwait Conference March 5, 2019. To complete the registration please settle the invoice which you will receive shortly. Please note that your seat is not confirmed without payment.

" EmailBody=EmailBody & "Please contact us for further assistance on +971 4 4356616 or marleen@sesam-uae.com

" end sub sub PrepareEmailBody_CreditCard() EmailBody="Thank you " & title(personNo) & " " & attention(personNo) & ",

" EmailBody=EmailBody & "We received your registration details for the Safety Design in Buildings Kuwait Conference March 5, 2019. Please note that you did not complete the payment and that your seat is not confirmed without payment.

" EmailBody=EmailBody & "Please re-register or contact us for further assistance on +971 4 4356616 or marleen@sesam-uae.com

" end sub sub PrepareEmailBody_Registered() EmailBody="Thank you " & title(personNo) & " " & attention(personNo) & ",

" EmailBody=EmailBody & "We received your registration details for the Safety Design in Buildings Kuwait Conference March 5, 2019. Please note that you did not complete the payment and that your seat is not confirmed without payment.

" EmailBody=EmailBody & "Please re-register or contact us for further assistance on +971 4 4356616 or marleen@sesam-uae.com

" end sub %>