%
'#
'### Redirect to SSL if the user is on HTTP by checking the server port number
'#
'If Request.ServerVariables("SERVER_PORT") = 80 Then
'Response.Redirect "https://secured.icukhosting.co.uk/scratch/main_site/subscriptions_form.asp"
'Else
'End If
'#
'### The Following Response Actions are required to prevent the
'### Page Has Expired Message from appearing when re-entering the Page
'#
Response.Expires = 0
Response.CacheControl = "PUBLIC"
Response.AddHeader "PRAGMA", "NO-CACHE"
'#
'### Form fields
'#
Dim gs_Frm_Name
Dim gs_Frm_Address
Dim gs_Frm_Post_Code
Dim gs_Frm_Phone_Number
Dim gs_Frm_Email_Addr
Dim gs_Frm_Region
Dim gs_Frm_Card_Type
Dim gs_Frm_Card_Number
Dim gs_Frm_Card_Month
Dim gs_Frm_Card_Year
Dim gs_Frm_Card_Issue
Dim gs_Frm_Card_Start_Month
Dim gs_Frm_Card_Start_Year
Dim gs_Frm_Card_CVV
'#
'### Error Start and End Tags
'#
Dim gs_Name_Error_Field
Dim gs_Name_Error_Start
Dim gs_Name_Error_End
Dim gs_Address_Error_Field
Dim gs_Address_Error_Start
Dim gs_Address_Error_End
Dim gs_Post_Code_Error_Field
Dim gs_Post_Code_Error_Start
Dim gs_Post_Code_Error_End
Dim gs_Phone_Number_Error_Field
Dim gs_Phone_Number_Error_Start
Dim gs_Phone_Number_Error_End
Dim gs_Email_Addr_Error_Field
Dim gs_Email_Addr_Error_Start
Dim gs_Email_Addr_Error_End
Dim gs_Region_Error_Field
Dim gs_Region_Error_Start
Dim gs_Region_Error_End
Dim gs_Card_Type_Error_Field
Dim gs_Card_Type_Error_Start
Dim gs_Card_Type_Error_End
Dim gs_Card_Number_Error_Field
Dim gs_Card_Number_Error_Start
Dim gs_Card_Number_Error_End
Dim gs_Card_Month_Error_Field
Dim gs_Card_Month_Error_Start
Dim gs_Card_Month_Error_End
Dim gs_Card_Year_Error_Field
Dim gs_Card_Year_Error_Start
Dim gs_Card_Year_Error_End
Dim gs_Card_Issue_Error_Field
Dim gs_Card_Issue_Error_Start
Dim gs_Card_Issue_Error_End
Dim gs_Card_Start_Month_Error_Field
Dim gs_Card_Start_Month_Error_Start
Dim gs_Card_Start_Month_Error_End
Dim gs_Card_Start_Year_Error_Field
Dim gs_Card_Start_Year_Error_Start
Dim gs_Card_Start_Year_Error_End
Dim gs_Card_CVV_Error_Field
Dim gs_Card_CVV_Error_Start
Dim gs_Card_CVV_Error_End
Dim gb_Error_Found
Dim i_Entry_Count
'#
'### Assign the default Input Field Display Classes
'#
gs_Name_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Address_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Post_Code_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Phone_Number_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Email_Addr_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Region_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Card_Type_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Card_Number_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Card_Month_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Card_Year_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Card_Issue_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Card_Start_Month_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Card_Start_Year_Error_Field = sk_INPUT_FIELD_NORMAL
gs_Card_CVV_Error_Field = sk_INPUT_FIELD_NORMAL
'#
'#####################################################################
'###
'### VB_Store_Request_Form_Data
'###
'#####################################################################
'#
Sub VB_Store_Request_Form_Data()
'#
'### Copy the information submited in the form to working storage
'#
gs_Frm_Name = Trim(Request.Form("txt_Name"))
gs_Frm_Address = Trim(Request.Form("txt_address"))
gs_Frm_Post_Code = Trim(Request.Form("txt_post_code"))
gs_Frm_Phone_Number = Trim(Request.Form("txt_Phone_Number"))
gs_Frm_Email_Addr = Trim(Request.Form("txt_Email_Addr"))
gs_Frm_Region = Request.Form("cmb_Region")
gs_Frm_Card_Type = Request.Form("cmb_card_type")
gs_Frm_Card_Number = Trim(Request.Form("txt_card_number"))
gs_Frm_Card_Month = Trim(Request.Form("cmb_card_month"))
gs_Frm_Card_Year = Trim(Request.Form("cmb_card_year"))
gs_Frm_Card_Issue = Trim(Request.Form("txt_card_issue"))
gs_Frm_Card_Start_Month = Request.Form("startmonth")
gs_Frm_Card_Start_Year = Request.Form("startyear")
gs_Frm_Card_CVV = Request.Form("cvv")
End Sub
'#
'########################################################
'###
'### VB_Valid_Form
'###
'########################################################
'#
Function VB_Valid_Form()
'#
'### Assume no Errors will be found
'#
gb_Error_Found = False
'#
'### Validate the Name
'#
GVB_Valid_Text gs_Frm_Name _
, gs_Name_Error_Field _
, gs_Name_Error_Start _
, gs_Name_Error_End _
, gb_Error_Found
'#
'### Validate the address
'#
GVB_Valid_Text gs_Frm_Address _
, gs_Address_Error_Field _
, gs_Address_Error_Start _
, gs_Address_Error_End _
, gb_Error_Found
'#
'### Validate the Post_Code
'#
GVB_Valid_Text gs_Frm_Post_Code _
, gs_Post_Code_Error_Field _
, gs_Post_Code_Error_Start _
, gs_Post_Code_Error_End _
, gb_Error_Found
'#
'### Validate the Phone_Number
'#
GVB_Valid_Tel_No gs_Frm_Phone_Number _
, gs_Phone_Number_Error_Field _
, gs_Phone_Number_Error_Start _
, gs_Phone_Number_Error_End _
, gb_Error_Found
'#
'### Validate the EMail Address
'#
GVB_Valid_EMail_Addr gs_Frm_EMail_Addr _
, gs_EMail_Addr_Error_Field _
, gs_EMail_Addr_Error_Start _
, gs_EMail_Addr_Error_End _
, gb_Error_Found
'#
'### Validate the Region
'#
GVB_Valid_Text gs_Frm_Region _
, gs_Region_Error_Field _
, gs_Region_Error_Start _
, gs_Region_Error_End _
, gb_Error_Found
'#
'### Validate the Card Type
'#
GVB_Valid_Text gs_Frm_Card_Type _
, gs_Card_Type_Error_Field _
, gs_Card_Type_Error_Start _
, gs_Card_Type_Error_End _
, gb_Error_Found
'#
'### Validate the Card Number
'#
GVB_Valid_Text gs_Frm_Card_Number _
, gs_Card_Number_Error_Field _
, gs_Card_Number_Error_Start _
, gs_Card_Number_Error_End _
, gb_Error_Found
GVB_Valid_Numeric gs_Frm_Card_Number _
, gs_Card_Number_Error_Field _
, gs_Card_Number_Error_Start _
, gs_Card_Number_Error_End _
, gb_Error_Found _
, True _
, True
'#
'### Validate the Expiry Month
'#
GVB_Valid_Text gs_Frm_Card_Month _
, gs_Card_Month_Error_Field _
, gs_Card_Month_Error_Start _
, gs_Card_Month_Error_End _
, gb_Error_Found
'#
'### Validate the Expiry Year
'#
GVB_Valid_Text gs_Frm_Card_Year _
, gs_Card_Year_Error_Field _
, gs_Card_Year_Error_Start _
, gs_Card_Year_Error_End _
, gb_Error_Found
'#
'### Continue the Date Validation provided they do not already have Errors.
'#
If gs_Card_Month_Error_Field = sk_INPUT_FIELD_NORMAL _
And gs_Card_Year_Error_Field = sk_INPUT_FIELD_NORMAL Then
'#
'### Make sure the Credit Card hasn't expired
'#
Dim dte_Temp_Card_Date
Dim dte_Temp_Present_Date
dte_Temp_Card_Date = DateSerial(gs_Frm_Card_Year, gs_Frm_Card_Month, 30)
dte_Temp_Present_Date = Date()
If dte_Temp_Card_Date < dte_Temp_Present_Date Then
'#
'### Set Error Message Indicating Start Date > End Date
'#
GVB_Set_Error gs_Frm_Card_Month _
, gs_Card_Month_Error_Field _
, gs_Card_Month_Error_Start _
, gs_Card_Month_Error_End _
, gb_Error_Found
GVB_Set_Error gs_Frm_Card_Year _
, gs_Card_Year_Error_Field _
, gs_Card_Year_Error_Start _
, gs_Card_Year_Error_End _
, gb_Error_Found
End If
End If
'#
'### Validate the Issue Number only if it's Switch / Solo (Type 3)
'#
If gs_Frm_Card_Type = "Switch" Then
GVB_Valid_Text gs_Frm_Card_Issue _
, gs_Card_Issue_Error_Field _
, gs_Card_Issue_Error_Start _
, gs_Card_Issue_Error_End _
, gb_Error_Found
GVB_Valid_Numeric gs_Frm_Card_Issue _
, gs_Card_Issue_Error_Field _
, gs_Card_Issue_Error_Start _
, gs_Card_Issue_Error_End _
, gb_Error_Found _
, True _
, True
End If
'#
'### Indicate the Success / Failure of the Form Validation
'#
VB_Valid_Form = Not gb_Error_Found
End Function
'#
'#####################################################################
'###
'### VB_EMail_Details
'###
'#####################################################################
'#
Sub VB_EMail_Details()
Dim obj_Mail
Dim s_Body
Dim sk_EMAIL_FROM_NAME
Dim sk_EMAIL_FROM_ADDR
sk_EMAIL_FROM_NAME = "Online Subscriptions form"
sk_EMAIL_FROM_ADDR = "website@scratchmagazine.co.uk"
'#
'### Just in case the Mail server starts behaving badly
'#
Set obj_Mail = Server.CreateObject("CDONTS.NewMail")
'#
'### Test for Object Existance
'#
If IsObject(obj_Mail) then
'#
'### Assign the Mail Type Information
'#
obj_Mail.BodyFormat = CdoBodyFormatHTML
obj_Mail.MailFormat = CdoMailFormatMime
obj_Mail.Importance = CdoNormal
'#
'### Construct the Body of the Message to be sent
'#
s_Body = ""
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
INTERNET EMail
" & vbCrLf
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
" & vbCrLf
s_Body = s_Body & "
The following Client Sent an EMail at " & Now() & "
" & vbCrLf
'#
'### Construct the Mail Object components
'#
obj_Mail.From = sk_EMAIL_FROM_NAME & " <" & sk_EMAIL_FROM_ADDR & ">"
obj_Mail.Value("Reply-To") = gs_Frm_Email_Addr
obj_Mail.To = "pam@scratchsubs.co.uk"
'#
'### Apply the subject to the email
'#
obj_Mail.Subject = "Scratch Magazine Email Request From - " & gs_Frm_Name
'#
'### Bound the Body with HTML Tags
'#
s_Body = "" & vbCrLf & s_Body & vbCrLf & ""
'#
'### Apply the previously formatted Body
'#
obj_Mail.Body = s_Body
'#
'### Send the Mail
'#
obj_Mail.Send
'#
'### Close the Mail Object
'#
Set obj_Mail = Nothing
End If
End Sub
'#
'###################################################################
'###
'### VB_Email_Customer
'###
'###################################################################
'#
Sub VB_Email_Customer(s_Parm_Email)
Dim s_Body
Dim objCDO
'#
'### Compose the email to be sent
'#
s_Body = ""
s_Body = s_Body & "Dear " & gs_Frm_Name & "," & vbNewLine & vbNewLine
s_Body = s_Body & "Thank you very much for you subscription request which has been received "
s_Body = s_Body & "and will be processed shortly. Should there be any problems concerning "
s_Body = s_Body & "this request you will be contacted but should you not hear anything your "
s_Body = s_Body & "subscription will start from the next available issue. " & vbNewLine & vbNewLine
s_Body = s_Body & "Should you have any questions, please do not hesitate to contact us." & vbNewLine & vbNewLine
s_Body = s_Body & "Please note your statement will show payment to Seed Publishing Ltd." & vbNewLine & vbNewLine
s_Body = s_Body & "Thanks. " & vbNewLine & vbNewLine
s_Body = s_Body & "Scratch Magazine" & vbNewLine
s_Body = s_Body & "1 The Court yard" & vbNewLine
s_Body = s_Body & "Market Square" & vbNewLine
s_Body = s_Body & "Westerham" & vbNewLine
s_Body = s_Body & "Kent" & vbNewLine
s_Body = s_Body & "TN161AZ" & vbNewLine
s_Body = s_Body & "Tel:01959 547000 Fax:01959 565119" & vbNewLine
s_Body = s_Body & "http://www.scratchmagazine.co.uk" & vbNewLine
'#
'### Create mailer objects
'#
set objCDO = Server.CreateObject("CDONTS.NewMail")
'#
'### Specify mailer headers
'#
objCDO.From = "Sctatch Magazine "
objCDO.To = s_Parm_Email
'#
'### Set subject email
'#
objCDO.Subject = "Subscription Request Received " & Now()
'#
'### Specify the body of the email
'#
objCDO.Body = s_Body
'#
'### Send the email
'#
objCDO.Send
'#
'### Close mailer object
'#
set objCDO = Nothing
end Sub
'#
'#####################################################################
'###
'### VB_Write_Region_Options
'###
'#####################################################################
'#
Sub VB_Write_Region_Options(s_Parm_Region)
Dim as_Region(3)
Dim i_Region
Dim s_Selected
Dim s_HTML
'#
'### Initialise the Array of Title Values
'#
as_Region(1)="UK & Northern Ireland - £34.00"
as_Region(2)="Europe - £49.00"
as_Region(3)="Rest of World - £74.00"
'#
'### Initialise the HTML String
'#
s_HTML = ""
'#
'### Loop through the Region Array
'#
For i_Region = 1 to UBound(as_Region)
'#
'### Test to See if the current Title should be selected
'#
If s_Parm_Region = as_Region(i_Region) Then
s_Selected = " Selected "
Else
s_Selected = ""
End If
'#
'### Write the Option Value
'#
s_HTML = s_HTML & "" & vbCrLf
Next
'#
'### Write the constructed HTML String
'#
Response.Write s_HTML
End Sub
'#
'#####################################################################
'###
'### VB_Write_Card_Type_Options
'###
'#####################################################################
'#
Sub VB_Write_Card_Type_Options(s_Parm_Card_Type)
Dim as_Card_Type(4)
Dim i_Card_Type
Dim s_Selected
Dim s_HTML
'#
'### Initialise the Array of Title Values
'#
as_Card_Type(1)="Visa"
as_Card_Type(2)="Mastercard"
as_Card_Type(3)="Switch OR Maestro"
as_Card_Type(4)="Solo"
'#
'### Initialise the HTML String
'#
s_HTML = ""
'#
'### Loop through the Card_Type Array
'#
For i_Card_Type = 1 to UBound(as_Card_Type)
'#
'### Test to See if the current Title should be selected
'#
If s_Parm_Card_Type = as_Card_Type(i_Card_Type) Then
s_Selected = " Selected "
Else
s_Selected = ""
End If
'#
'### Write the Option Value
'#
s_HTML = s_HTML & "" & vbCrLf
Next
'#
'### Write the constructed HTML String
'#
Response.Write s_HTML
End Sub
'#
'#####################################################################
'###
'### VB_Write_Month_Options
'###
'#####################################################################
'#
Sub VB_Write_Month_Options(s_Parm_Month)
Dim as_Month(12)
Dim i_Month
Dim s_Selected
Dim s_HTML
'#
'### Initialise the Array of Title Values
'#
as_Month(1)="01"
as_Month(2)="02"
as_Month(3)="03"
as_Month(4)="04"
as_Month(5)="05"
as_Month(6)="06"
as_Month(7)="07"
as_Month(8)="08"
as_Month(9)="09"
as_Month(10)="10"
as_Month(11)="11"
as_Month(12)="12"
'#
'### Initialise the HTML String
'#
s_HTML = ""
'#
'### Loop through the Month Array
'#
For i_Month = 1 to UBound(as_Month)
'#
'### Test to See if the current Title should be selected
'#
If s_Parm_Month = as_Month(i_Month) Then
s_Selected = " Selected "
Else
s_Selected = ""
End If
'#
'### Write the Option Value
'#
s_HTML = s_HTML & "" & vbCrLf
Next
'#
'### Write the constructed HTML String
'#
Response.Write s_HTML
End Sub
'#
'#####################################################################
'###
'### VB_Write_Year_Options
'###
'#####################################################################
'#
Sub VB_Write_Year_Options(s_Parm_Year)
Dim as_Year(11)
Dim i_Year
Dim s_Selected
Dim s_HTML
'#
'### Initialise the Array of Title Values
'#
as_Year(1)="04"
as_Year(2)="05"
as_Year(3)="06"
as_Year(4)="07"
as_Year(5)="08"
as_Year(6)="09"
as_Year(7)="10"
as_Year(8)="11"
as_Year(9)="12"
as_Year(10)="13"
as_Year(11)="14"
'#
'### Initialise the HTML String
'#
s_HTML = ""
'#
'### Loop through the Year Array
'#
For i_Year = 1 to UBound(as_Year)
'#
'### Test to See if the current Title should be selected
'#
If s_Parm_Year = as_Year(i_Year) Then
s_Selected = " Selected "
Else
s_Selected = ""
End If
'#
'### Write the Option Value
'#
s_HTML = s_HTML & "" & vbCrLf
Next
'#
'### Write the constructed HTML String
'#
Response.Write s_HTML
End Sub
'#
'#####################################################################
'###
'### R e - E n t r y V a l i d a t i o n
'###
'#####################################################################
'#
Dim b_Email_Valid
Dim l_Return
'#
'### Determine the number of attempts to enter the page
'#
i_Entry_Count = CInt(Request.Form("txt_Entry_Count"))
'#
'### Validate the Form Contents after the first Attempt
'#
if i_Entry_Count > 0 Then
'#
'### Store the Request Form Data
'#
VB_Store_Request_Form_Data
'#
'### Validate the Form Data
'#
b_Email_Valid = VB_Valid_Form()
'#
'### Provided the Email Definition Details are valid continue
'#
If b_Email_Valid Then
'#
'### E:Mail the Office with the Client details
'#
VB_EMail_Details
'#
'### Send the email to the customer
'#
VB_Email_Customer gs_Frm_Email_Addr
'#
'### Redirect User to Client Thank You Page
'#
Response.Clear
Response.Redirect "Thanks.html"
End If
End If
'#
'### Increment the Entry Count
'#
i_Entry_Count = i_Entry_Count + 1
%>
Scratch Magazine | Card Subscription Form
Subscriptions
Subscribe
to
Magazine for only £34.00 (UK & Northern Ireland), £49.00 (Europe)
or £74.00 (Rest of the World) and in addition to receiving
all 12 issues you can also enjoy the following benefits:
Free
prize draws from top high street designer names to some fantastic
professional trade products. Up to 10% discount on all Scratch promotions
including Book Club purchases.
Please
use one of the three options below to order your subscription.
1.
Call our Subscriptions hotline on: 020 8773 1313