%
Response.Expires = 0
Response.Buffer = True
'Retrieving form input and assigning to a variable
'txtLastName is the name of the text box on the form
strLastName = Request.Form ("txtLastName")
strFirstName = Request.Form("txtFirstName")
strAgencyName = Request.Form("txtAgencyName")
strUserName2 = Request.Form ("txtUserName")
strPassword = Request.Form("txtPassword")
sFreeAccess = Request.Form("radFreeAgent")
strAddress = Request.Form("txtAddress")
strCity = Request.Form("txtCity")
strState = Request.Form("State")
strZip = Request.Form("txtZip")
strCountry = Request.Form("Country")
strPhoneNumber = Request.Form("txtPhoneNumber")
strFaxNumber = Request.Form("txtFaxNumber")
strEmailAddress = Request.Form("txtEmailAddress")
strUploadPic = Request.Form("radUploadPic")
strSubscriptions = request("radSubscriptions")
strWebsite = Request.Form("txtWebsite")
strDescription = Request.Form("txtDescription")
strPager = Request.Form("txtPager")
strCell = Request.Form("txtCell")
strAccessLevel = Request.Form("txtAccessLevel")
'This code only runs if the submit button is clicked
if Request.Form <> "" then
'Sets an error message if any required fields are left blank
if strAccessLevel = "" or strUserName2 = "" or strPassword = "" or strLastName = "" or strFirstName = "" or strAddress = "" or strcity = "" or strState = "" or strZip = "" or strCountry = "" or strPhoneNumber = "" or strEmailAddress = "" then
WarningErrMsg = "
All fields marked with an * are required."
end if
if strPhoneNumber <> "" and not isnumeric(strPhoneNumber) then
warningErrMsg = WarningErrMsg + "
Phone # can only contain numbers."
end if
if strPhoneNumber <> "" and len(strPhoneNumber)<> "10" then
warningErrMsg = WarningErrMsg + "
Phone # must contain 10 digits. Please include the area Code."
end if
if not isnumeric(strFaxNumber) and strFaxNumber <> "" then
warningErrMsg = WarningErrMsg + "
Fax # can only contain numbers."
end if
if strFaxNumber <> "" and len(strFaxNumber)<> "10" then
warningErrMsg = WarningErrMsg + "
Fax # must contain 10 digits. Please include the area Code."
end if
'Checks for a valid email address
if strEmailAddress <> "" and (instr( strEmailAddress, "@") = 0 or instr( strEmailAddress, ".") = 0) then
WarningErrMsg = WarningErrMsg + "
Email Address must be in the form account@server.com."
end if
if strAccessLevel2 <> "" and (strAccessLevel2 < "1" or strAccessLevel2 > "9") then
warningErrMsg = WarningErrMsg + "
Access Level must be between 1 to 9."
end if
'If error message was not set, then all error checks were passed; Connect to the database
if warningErrMsg = "" then
strFullName = strFirstName + " " + strLastName
' Create a recordset object to store specific table information
Set objRS = Server.CreateObject("ADODB.Recordset")
'Establish what records you want selected for the SQL query string
SQL = "Select * From TblLogin where (UserName = '" + strUserName2 + "')"
'Set the recordset object equal to the SQL query string
objRS.Open SQL, objADO, 1, 3
if objRS.EOF then
objRs.addnew
objRs.Fields("LastName") = strLastName
objRs.Fields("FirstName") = strFirstName
objRs.Fields("AgencyName") = strAgencyName
objRs.Fields("Website") = strWebsite
objRs.Fields("Pager") = strPager
objRs.Fields("CellPhone") = strCell
objRs.Fields("AgentDescription") = strDescription
objRs.Fields("Address") = strAddress
objRs.Fields("City") = strCity
objRs.Fields("State") = strState
objRs.Fields("Zip") = strZip
objRs.Fields("Country") = strCountry
objRs.Fields("PhoneNumber") = strPhoneNumber
objRs.Fields("FaxNumber") = strFaxNumber
objRs.Fields("EmailAddress") = strEmailAddress
objRs.Fields("UserName") = strUserName2
objRs.Fields("Password") = strPassword
if sFreeAccess = "1" then
objRs.Fields("AccessLevel") = "6"
end if
objRs.Fields("AccessLevel") = "2"
objRs.Fields("ReceiveMailings") = strSubscriptions
objrs.Fields("signupdate") = date()
objRs.update
if strSubscriptions = "1" then
' Create a recordset object to store specific table information
Set objEmail = Server.CreateObject("ADODB.Recordset")
'Establish what records you want selected for the SQL query string
SQL = "Select * From TblEmail where (EmailAddress = '" + strEmailAddress + "')"
'Set the recordset object equal to the SQL query string
objEmail.Open SQL, objADO, 1, 3
if objEmail.EOF then
objEmail.addnew
objEmail("EmailAddress") = strEmailAddress
objEmail("DateAdded") = Date()
objEmail.update
WarningErrMsg = strEmailAddress + " has been sucessfully added to our mailing list."
else
WarningErrMsg = strEmailAddress + " has already joined our mailing list."
end if
end if
'if no error and if want to upload pic of self now do so
if strUploadPic = "1" then
Response.Redirect "AgentPicUpload.asp?Id=" & objRs("LoginId")
end if
'else redirect to success page and send registration email
response.redirect "registrationsuccess.asp?Id=" & objRs("LoginId")
else
warningErrMsg = "
Please choose another user name. Another user exists with the user name you have chosen."
end if
end if
end if
%>
CREATE AN ACCOUNT
Fill in the required information below to an account.
Fields marked with an * are required.
| Error(s):<%= warningErrMsg %> |