Agency Program Registration
<%
Dim strTo, strSubject, strBody 'Strings for recipient, subject, body
Dim objCDOMail 'The CDO object
Errors = ""
'First we'll read in the values entered
name = Request.Form("name")
referred_by = Request.Form("referred_by")
company = Request.Form("company")
companytype = Request.Form("companytype")
companydesc = Request.Form("companydesc")
title = Request.Form("title")
email = Request.Form("email")
phone1 = Request.Form("phone1")
phone2 = Request.Form("phone2")
phone3 = Request.Form("phone3")
account_fax_phone1 = Request.Form("account_fax_phone1")
account_fax_phone2 = Request.Form("account_fax_phone2")
account_fax_phone3 = Request.Form("account_fax_phone3")
account_cell_phone1 = Request.Form("account_cell_phone1")
account_cell_phone2 = Request.Form("account_cell_phone2")
account_cell_phone3 = Request.Form("account_cell_phone3")
street = Request.Form("street")
city = Request.Form("city")
state = Request.Form("state")
zip = Request.Form("zip")
web_address = Request.Form("web_address")
comments = Request.Form("comments")
DateTime = Now()
DisplayMonth = month(DateTime)
DisplayDay = day(DateTime)
DisplayYear = year(DateTime)
DisplayHour = Hour(DateTime)-1
DisplayMinute = minute(DateTime)
DisplayDate = DisplayMonth & "/" & DisplayDay & "/" & DisplayYear & " " & DisplayHour & ":" & DisplayMinute
' Check for errors
if name = "" then
Errors = "Please enter your name."
elseif company = "" then
Errors = "Please enter your Company."
elseif (email = "") or (Not IsValidEmail(email)) then
Errors = "Please enter a valid e-mail address."
end if
if Errors <> "" then
%>
After submitting this form, you will be e-mailed a Username and Password with further instructions
to begin participation in the Design Wonders Networking Agency Program.
If you have any questions, please submit them to
info@designwonders.com before
registering.
<%
If (Errors <> "" and request.form("submit") <> "") Then
%>
<%= Errors %>
<%
end if
%>
<%
Else
if name = "" then
name = " "
end if
if referred_by = "" then
referred_by = " "
end if
if company = "" then
company = " "
end if
if companytype = "" then
companytype = " "
end if
if companydesc = "" then
companydesc = " "
end if
if title = "" then
title = " "
end if
if email = "" then
email = " "
end if
if phone1 <> "" then
phone = phone1 & "-" & phone2 & "-" & phone3
else
phone = " "
end if
if account_fax_phone1 <> "" then
account_fax_phone = account_fax_phone1 & "-" & account_fax_phone2 & "-" & account_fax_phone3
else
account_fax_phone = " "
end if
if account_cell_phone1 <> "" then
account_cell_phone = account_cell_phone1 & "-" & account_cell_phone2 & "-" & account_cell_phone3
else
account_cell_phone = " "
end if
if street = "" then
street = " "
end if
if city = "" then
city = " "
end if
if state = "" then
state = " "
end if
if zip = "" then
zip = " "
end if
if web_address = "" then
web_address = " "
end if
if comments = "" then
comments = " "
end if
function trouble()
characters= "1234567890abcdefghijklmnopqrstuvwxyz"
randomize
dim RndVal,i
for i = 1 to 8
RndVal = int((len(characters)*rnd)+1)
Trouble =Trouble & mid(characters,RndVal,1)
next
end function
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "DBQ=" & Server.MapPath("/data/agency.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;MaxBufferSize=8192;Threads=20;", "admin", "hhm"
NoSpaceName = replace(name, " ", "")
TroubleTicket = trouble()
username = LCase(Trim(Left(NoSpaceName, 6)))
strSubject = "Agency Program Registration"
strBody = "Thank you for registering with the Design Wonders Networking Agency Program! Your Username and Password are below:" & vbCrLf & vbCrLf
strBody = strBody & "Username: " & username & vbCrLf
strBody = strBody & "Password: " & TroubleTicket & vbCrLf & vbCrLf
strBody = strBody & "To submit and keep track of the leads you provide to Design Wonders Networking you can log in to "
strBody = strBody & "your Agency Partner Control Panel at http://www.designwonder.com/agency.asp." & vbCrLf & vbCrLf
strBody = strBody & "Below is the information you submitted to the Design Wonders Networking Agency Program:" & vbCrLf & vbCrLf
if name <> " " then
strBody = strBody & "Name: " & name & vbCrLf
end if
if company <> " " then
strBody = strBody & "Company: " & company & vbCrLf
end if
if companytype <> " " then
strBody = strBody & "Company Type: " & companytype & vbCrLf
end if
if companydesc <> " " then
strBody = strBody & "Company Description: " & companydesc & vbCrLf
end if
if title <> " " then
strBody = strBody & "Title: " & title & vbCrLf
end if
if email <> " " then
strBody = strBody & "E-mail: " & email & vbCrLf
end if
if phone <> "--" then
strBody = strBody & "Phone: " & phone & vbCrLf
end if
if account_cell_phone <> " " then
strBody = strBody & "Cell Phone: " & account_cell_phone & vbCrLf
end if
if account_fax_phone <> " " then
strBody = strBody & "Fax Number: " & account_fax_phone & vbCrLf
end if
if street <> " " then
strBody = strBody & "Address: " & street & vbCrLf & city & ", " & state & " " & zip & vbCrLf & vbCrLf
end if
if referred_by <> " " then
strBody = strBody & "Referred By: " & referred_by & vbCrLf
end if
if web_address <> " " then
strBody = strBody & "Website Address:" & web_address & vbCrLf
end if
if comments <> " " then
strBody = strBody & "Comments: " & comments & vbCrLf
end if
strBody = strBody & vbCrLf
DisplayMonth = month(DateTime)
DisplayDay = day(DateTime)
DisplayYear = year(DateTime)
DisplayHour = Hour(DateTime)-1
DisplayMinute = minute(DateTime)
DisplayDate = DisplayMonth & "/" & DisplayDay & "/" & DisplayYear & " " & DisplayHour & ":" & DisplayMinute
strSQL = ""
strSQL = strSQL & "INSERT INTO agency (username, password, name, account_cell_phone, account_fax_phone, referred_by, company, companytype, companydesc, title, email, phone, street, city, state, zip, web_address, comments, DateTime1)"
strSQL = strSQL & " VALUES ("
strSQL = strSQL & "'" & username & "', "
strSQL = strSQL & "'" & TroubleTicket & "', "
strSQL = strSQL & "'" & name & "', "
strSQL = strSQL & "'" & account_cell_phone & "', "
strSQL = strSQL & "'" & account_fax_phone & "', "
strSQL = strSQL & "'" & referred_by & "', "
strSQL = strSQL & "'" & company & "', "
strSQL = strSQL & "'" & companytype & "', "
strSQL = strSQL & "'" & companydesc & "', "
strSQL = strSQL & "'" & title & "', "
strSQL = strSQL & "'" & email & "', "
strSQL = strSQL & "'" & phone & "', "
strSQL = strSQL & "'" & street & "', "
strSQL = strSQL & "'" & city & "', "
strSQL = strSQL & "'" & state & "', "
strSQL = strSQL & "'" & zip & "', "
strSQL = strSQL & "'" & web_address & "', "
strSQL = strSQL & "'" & comments & "', "
strSQL = strSQL & "'" & DisplayDate & "');"
MyConn.Execute strSQL, adAffectAll, adCmdText Or adExecuteNoRecords
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = "" & request.form("name") & " <" & email & ">"
objCDOMail.To = "Design Wonders Networking "
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.MailFormat = 0 ' CdoMailFormatMime
objCDOMail.Send
Set objCDOMail = Nothing
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = "Design Wonders Networking "
objCDOMail.To = "" & request.form("name") & " <" & email & ">"
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.MailFormat = 0 ' CdoMailFormatMime
objCDOMail.Send
Set objCDOMail = Nothing
Response.Write "Thank you for Registering! "
response.write "Your information has now been sumitted for the Agency Program. You will be receiving an e-mail at " _
& email & " with your Username, Password, and additional instructions. "
response.write "Back to Design Wonders Networking home page. "
End If
Function IsValidEmail(strEmail)
Dim bIsValid
bIsValid = True
If Len(strEmail) < 5 Then
bIsValid = False
Else
If Instr(1, strEmail, " ") <> 0 Then
bIsValid = False
Else
If InStr(1, strEmail, "@", 1) < 2 Then
bIsValid = False
Else
If InStrRev(strEmail, ".") < InStr(1, strEmail, "@", 1) + 2 Then
bIsValid = False
End If
End If
End If
End If
IsValidEmail = bIsValid
End Function
%>
|