%@ Language=VBScript %>
<%
set asplObj=Server.CreateObject("ASPL.Login")
' These const vars are used when sending emails
Const ADMIN_EMAIL="admin@pianousa.com"
Const EMAIL_SUBJECT="PianoUSA.com Piano Instructor Membership"
Const SIGNUPGROUP="Instructors"
Const LOGIN_PAGE="http://www.pianousa.com/Instructor_Data.asp" ' this must NOT be asplogin.asp - it should be a page protected by ASPLogin.
%>
<%
' ============================== Read Display Table ============================
set conn=Server.CreateObject("ADODB.Connection")
set ors=Server.CreateObject("ADODB.Recordset")
set xs=Server.CreateObject("ADODB.Recordset")
'----------------
sqlDisp="SELECT * FROM getasplDispTbl "
conn.Open asplObj.getasplConnStr
' =============================== end display table ============================
if not isEmpty(Request.Form("submit")) then
if Request.Form("MembershipType")="" then memberErr=true else memberErr=false
if len(Request.Form("username"))=0 then usernameErr=true else usernameErr=false
if len(Request.Form("password"))<4 then passwordErr=true else passwordErr=false
if StrComp(Request.Form("password"),Request.Form("verify_password"))<>0 then passwordMatchErr=true else passwordMatchErr=false
if columnv("firstname") = "Y" then
if len(Request.Form("firstname"))=0 then firstnameErr=true else firstnameErr=false
end if
if columnv("lastname") = "Y" then
if len(Request.Form("lastname"))=0 then lastnameErr=true else lastnameErr=false
end if
if columnv("emailAddress") = "Y" then
if len(Request.Form("emailAddress"))=0 then EmailAddressErr=true else EmailAddressErr=false
end if
if columnv("gender") = "Y" then
if len(Request.Form("gender"))=0 then genderErr=true else genderErr=false
end if
if (usernameErr or passwordErr or passwordMatchErr or firstnameErr or lastnameErr or EmailAddressErr or dobErr or genderErr)=false then
' set conn=server.CreateObject("ADODB.Connection")
set rs=server.CreateObject("ADODB.Recordset")
' conn.Open Session("asplConnStr")
rs.Open "SELECT * FROM asplUserTbl WHERE username='" & Request.Form("username") & "'",conn,adOpenKeyset,adLockOptimistic
if not rs.EOF then
usernameTakenErr=true
else
rs.AddNew
rs("username")=Request.Form("username")
rs("password")=Request.Form("password")
if columnv("Firstname") = "Y" then
rs("Firstname")=Request.Form("firstname")
end if
if columnv("Lastname") = "Y" then
rs("Lastname")=Request.Form("lastname")
end if
if columnv("EmailAddress") = "Y" then
rs("EmailAddress")=Request.Form("emailAddress")
end if
if columnv("DOB") = "Y" then
rs("DOB")=Request.Form("dob_m") & "/" & Request.Form("dob_d") & "/" & Request.Form("dob_y")
end if
if columnv("Gender") = "Y" then
rs("gender")=Request.Form("Gender")
end if
if columnv("MaritalStatus") = "Y" then
rs("MaritalStatus")=Request.Form("MaritalStatus")
end if
if columnv("Children") = "Y" then
rs("Children")=Request.Form("children")
end if
if columnv("Fax_number") = "Y" then
rs("Fax_number")=Request.Form("Fax_number")
end if
if columnv("Postalcode") = "Y" then
rs("Postalcode")=Request.Form("postalcode")
if columnv("How_hear") = "Y" then
rs("How_hear")=Request.Form("How_hear")
end if
end if
if columnv("NewsLetter") = "Y" then
if Request.Form("NewsLetter")="ON" then rs("NewsLetter")=true else rs("NewsLetter")=false
end if
rs.Update
userid=rs("userid")
rs.Close
rs.Open "SELECT * FROM asplGroupTbl WHERE groupname='" & Request.Form("membershipType") & "'",conn,adOpenStatic,adLockReadOnly
if not rs.eof then
groupid=rs("groupid")
rs.Close
conn.Execute "INSERT INTO asplMemberTbl (userid,groupid) VALUES (" & userid & "," & groupid & ")"
end if
conn.Close
set rs=Nothing
set conn=Nothing
SET JMail = Server.CreateObject("JMail.smtpmail")
JMail.ServerAddress = "formmail.strongsecure.com"
JMail.Sender =ADMIN_EMAIL
JMail.Subject =EMAIL_SUBJECT
JMail.AddRecipient Request.Form("EmailAddress")
JMail.Body = "Thank you " & Request.Form("firstname") & " for signing up." & vbCrLf & "Your username is = " & Request.Form("username") & vbCrLf & "Your password is = " & Request.Form("password") & vbCrLf & "Please keep this for your records." & vbCrLf & "**Click here: " & LOGIN_PAGE & " to login.**"
'JMail.AddHeader "Originating-IP",
'Request.ServerVariables("REMOTE_ADDR")
'JMail.Logging = True
JMail.Execute
SET JMail = Nothing
'original mailform code via asplogin
'set objMail=Server.CreateObject("CDONTS.Newmail")
'objMail.From=ADMIN_EMAIL
'objMail.To=Request.Form("EmailAddress")
'objMail.Subject=EMAIL_SUBJECT
'objMail.Body="Thank you " & Request.Form("firstname") & " for signing up." & vbCrLf & "Your username is = " & Request.Form("username") & vbCrLf & "Your password is = " & Request.Form("password") & vbCrLf & "Please keep this for your records." & vbCrLf & "**Click here: " & LOGIN_PAGE & " to login.**"
'objMail.Send
'set objMail=Nothing
SET JMail = Server.CreateObject("JMail.smtpmail")
JMail.ServerAddress = "formmail.strongsecure.com"
JMail.Sender =ADMIN_EMAIL
JMail.Subject =EMAIL_SUBJECT
JMail.AddRecipient ADMIN_EMAIL
JMail.Body ="New user " & Request.Form("username") & " has signed up to group " & Request.Form("MembershipType")& "."
'JMail.AddHeader "Originating-IP",
'Request.ServerVariables("REMOTE_ADDR")
'JMail.Logging = True
JMail.Execute
SET JMail = Nothing
'set objMail=Server.CreateObject("CDONTS.Newmail")
'objMail.From=ADMIN_EMAIL
'objMail.To=ADMIN_EMAIL
'objMail.Subject=EMAIL_SUBJECT
'objMail.Body="New user " & Request.Form("username") & " has signed up to group " & Request.Form("MembershipType")& "."
'objMail.Send
'set objMail=Nothing
Response.Redirect "Instructor_member_confirmation.htm"
Response.End
end if
else
errsOccured=true
end if
end if
%>
<% if errsOccured then %>
Please complete the fields marked in red to complete your
application. Then, resubmit the form.