%
Option Explicit
Dim sql, sqlflag, sentok, objMail, noObj, mailbody, HTML, fromemail, rsDonations, username, password, title, prompted, passwordconfirm, firstname, surname, email, dob, passwordLength, calltype, icon, updates, dobmonth, dobday, giftaid, showname, notfilled(4), badflag, count
'Assign form values to variables
'Make sure they've not put any quotation marks in their username
If InStr(username,chr(34)) <> 0 or InStr(username,chr(39)) <> 0 then
errorfunction("invalidchars")
end if
firstname = Request.Form("firstname")
surname = Request.Form("surname")
title = Request.Form("title")
email = Request.Form("email")
prompted = Request.Form("prompted")
giftaid = Request.Form("giftaid")
if Request.Form("updates") <> "" then updates = True else updates = False end if
'Only way to set a variable from a checkbox:
if Request.Form("showname") <> "" then showname = True else showname = False end if
'Only way to set a variable from a checkbox:
'Check everything's been filled in, badflag determines whether error function is called
badflag = 0
'nofilled() is an array that will store the fields which are not filled in
if firstname = "" then
notfilled(0) = "Your first name"
badflag = 1
end if
if surname = "" then
notfilled(1) = "Your surname"
badflag = 1
end if
if email = "" then
notfilled(2) = "Your E-mail address"
badflag = 1
end if
if giftaid = "" then
notfilled(3) = "Are you eligable for Gift Aid? (UK Only)"
badflag = 1
end if
if badflag = 1 then
signuperror()
end if
'Open connection and insert user details into the database
%>
<%
getstarsign()
DonationsUpdate()
Function DonationsUpdate()
On Error Resume Next
Set rsDonations = Server.CreateObject("ADODB.Recordset")
rsDonations.open "Donations", conn, 3, 3
rsDonations.AddNew
rsDonations("firstname") = firstname
rsDonations("surname") = surname
rsDonations("title") = title
rsDonations("email") = email
rsDonations("giftaid") = giftaid
rsDonations("prompted") = prompted
rsDonations("updates") = updates
rsDonations("showname") = showname
rsDonations.Update
if Err.Number = -2147217887 then
Err.clear
errorfunction("badusername")
else
%>
<%
fromemail = "info@edgeofexistence.org"
title = Request.Form ("title")
firstname = Request.Form ("firstname")
surname = Request.Form ("surname")
email = Request.Form ("email")
prompted = Request.Form ("prompted")
giftaid = Request.Form("giftaid")
updates = Request.Form("updates")
updates = Request.Form("showname")
set objMail = Server.CreateObject("CDONTS.NewMail")
mailbody = "Look Carly, someone is making a donation! " & vbcrlf & vbcrlf
mailbody = mailbody & "Title: " & title & vbcrlf
mailbody = mailbody & "Firstname: " & firstname & vbcrlf
mailbody = mailbody & "Surname: " & surname & vbcrlf
mailbody = mailbody & "----------------------------------------------------" & vbcrlf
mailbody = mailbody & "Email: " & email & vbcrlf & vbcrlf
mailbody = mailbody & "What prompted them to visit EDGE? " & prompted & vbcrlf & vbcrlf
mailbody = mailbody & "Are they eligable for Gift Aid donations? " & giftaid & vbcrlf & vbcrlf
mailbody = mailbody & "Would they like updates by email? " & updates & vbcrlf & vbcrlf
mailbody = mailbody & "Do they want their name displayed? " & showname & vbcrlf & vbcrlf
mailbody = mailbody & "----------------------------------------------------" & vbcrlf
objMail.Body = mailbody
objMail.to = ("info@edgeofexistence.org")
objMail.from = fromemail
objMail.subject = "New donation to EDGE"
objMail.send
set objMail = nothing
sentok = true
%>
<%
rsDonations.close
set rsDonations = nothing
conn.close
set conn = nothing
%>
<%
end if
End Function%>
<%
Function getstarsign()
dobmonth = Request.Form("birth_month")
dobday = Request.Form("birth_day")
Select Case dobmonth
Case 1
if dobday < 21 then
starsign = "Capricorn"
else
starsign = "Aquarius"
end if
Case 2
if dobday < 20 then
starsign = "Aquarius"
else
starsign = "Pisces"
end if
Case 3
if dobday < 21 then
starsign = "Pisces"
else
starsign = "Aries"
end if
Case 4
if dobday < 21 then
starsign = "Aries"
else
starsign = "Taurus"
end if
Case 5
if dobday < 22 then
starsign = "Taurus"
else
starsign = "Gemini"
end if
Case 6
if dobday < 22 then
starsign = "Gemini"
else
starsign = "Cancer"
end if
Case 7
if dobday < 24 then
starsign = "Cancer"
else
starsign = "Leo"
end if
Case 8
if dobday < 24 then
starsign = "Leo"
else
starsign = "Virgo"
end if
Case 9
if dobday < 24 then
starsign = "Virgo"
else
starsign = "Libra"
end if
Case 10
if dobday < 24 then
starsign = "Libra"
else
starsign = "Scorpio"
end if
Case 11
if dobday < 23 then
starsign = "Scorpio"
else
starsign = "Sagittarius"
end if
Case 12
if dobday < 22 then
starsign = "Sagittarius"
else
starsign = "Capricorn"
end if
End Select
End Function
%>
<%Function signuperror()%>
EDGE :: Collecting your details
Collecting your Details
You appear to have not filled in the following fields correctly: