%
'Setting HTTPS, force SSL'
If Request.ServerVariables("SERVER_PORT")=80 Then
Dim strSecureURL
strSecureURL = "https://"
strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
strSecureURL = strSecureURL & Request.ServerVariables("URL")
Response.Redirect strSecureURL
End If
%>
Buy Online!
Buy Surrounded Magazine Online!
$10 per copy, plus $2 S/H each
<%
'checks for submission'
if Request.Form("submitbutton") = "" Then
if Request.QueryString("error") <> "" Then
Response.Write Request.QueryString("error")
end if
%>
<%
else
Session("FirstName") = request("FirstName")
Session("LastName") = request("LastName")
Session("Address1") = request("Address1")
Session("Address2") = request("Address2")
Session("City") = request("City")
Session("State") = request("State")
Session("Zip") = request("Zip")
Session("Phone") = request("Phone")
Session("Email") = request("Email")
Session("CC") = Request.Form("cc")
Session("cctype") = Request.Form("cctype")
Session("expmonth") = Request.Form("expmonth")
Session("expyear") = Request.Form("expyear")
Session("expdate") = Request.Form("expmonth") & Request.Form("expyear")
Session("copies") = Request.Form("copies")
For Each x in Request.Form
If x <> "address2" Then
If Request.Form(x) = "" Then
Session.Contents("errormessage") = "" & UCase(x) & " is required."
%>
<%
Response.End
end if
end if
Next
Function ConvertCardNum(CardNum)
Set r = new RegExp
r.Global = True
r.IgnoreCase = True
r.Pattern = "([0-9*])"
cc = ""
cc = r.Replace(Mid(CardNum,1,len(CardNum)-4),"*") & Mid(CardNum,len(CardNum)-3,4)
ConvertCardNum = cc
End Function
if Session("copies") <= 0 then
Session("copies") = 1
end if
Session("Cost") = (10 * Session("copies")) + (2 * Session.Contents("copies"))
IF Session("CC") = "5490993420233779" THEN
Session("Cost") = 0.01
End If
Select Case Session("ccType")
Case "Mastercard"
Net = Session("Cost") * .98
Case "Visa"
Net = Session("Cost") * .98
Case "Amex"
Net = Session("Cost") * .9675
Case "Discover"
Net = Session("Cost") * .9775
End Select
IF ErrorMessage = "" THEN
' create the PNCOMClient component
Set client = Server.CreateObject("PFProCOMControl.PFProCOMControl.1")
'build the parameter list, such that we have a sale transaction and
'a credit card tender.
parmList = "TRXTYPE=S&TENDER=C&ZIP=" & Session("ZIP") & "&COMMENT1=Surrounded Magazine&COMMENT2=" & Session("firstname") & " " & Session.Contents("lastname")
'set the account form the html form
parmList = parmList & "&ACCT=" & Session("CC")
'set the password from the html form
parmList = parmList & "&PWD=chonline00"
'set the user from the HTML form
parmList = parmList & "&USER=campbellhall"
'set the vendor from the HTML form
parmList = parmList & "&VENDOR=campbellhall"
'set the partner from the HTML form
parmList = parmList & "&PARTNER=VeriSign"
'set the expiration date form the HTML form
parmList = parmList & "&EXPDATE=" & Session("Expdate")
'set the amount from the HTML form
parmList = parmList & "&AMT=" & Session("Cost")
'Response.Write parmList
Ctx1 = client.CreateContext("payflow.verisign.com", 443, 30, "", 0, "", "")
curString = client.SubmitTransaction(Ctx1, parmList, Len(parmList))
client.DestroyContext (Ctx1)
' handle the response
done = 0
Dim PNREF, RESPMSG, AUTHCODE, AVSADDR, AVSZIP, CVV2MATCH
'loop until we're done processing the entire string
Do while Len(curString) <> 0
'get the next name value pair
if InStr(curString,"&") Then
varString = Left(curString, InStr(curString , "&" ) -1)
else
varString = curString
end if
'Response.Write " "
'get the name part of the name/value pair
name = Left(varString, InStr(varString, "=" ) -1)
'get the value out of the name/value pair
value = Right(varString, Len(varString) - (Len(name)+1))
Select Case name
Case "PNREF"
PNREF = value
Case "RESPMSG"
RESPMSG = value
Case "AUTHCODE"
AUTHCODE = value
Case "AVSADDR"
AVSADDR = value
Case "AVSZIP"
AVSZIP = value
Case "CVV2MATCH"
CVV2MATCH = value
End Select
'write out the name/value pair in "name = value" format
'response.write name
'response.write " = "
'Response.Write value
'Response.Write " "
'skip over the &
if Len(curString) <> Len(varString) Then
curString = Right(curString, Len(curString) - (Len(varString)+1))
else
curString = ""
end if
Loop
IF RESPMSG = "Approved" THEN
Set Crypto = Server.CreateObject("crypto.Encryption")
ccnum = Crypto.EnCode(Session.Contents("cc"))
SQL = "exec dbo.ins_subscription '" & Session("firstname") & "','" & Session("lastname") & "','" & Session("address1") & "','" & Session("address2") & "','" & Session("city") & "','" & Session("state") & "','" & Session("zip") & "','" & Session("phone") & "','" & Session("email") & "','" & Session("cctype") & "','" & ccnum & "','" & Session("expdate") & "'," & Session("copies")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=AC15;Database=CampbellHall;Uid=ch_user;Pwd=ch_user&&;"
Conn.Execute(SQL)
Body = "
" & _
"
" & _
"
Firstname:
" & _
"
" & Session("firstname") & "
" & _
"
" & _
"
" & _
"
Lastname:
" & _
"
" & Session("lastname") & "
" & _
"
" & _
"
" & _
"
Address 1:
" & _
"
" & Session("address1") & "
" & _
"
" & _
"
" & _
"
Address 2:
" & _
"
" & Session("address2") & "
" & _
"
" & _
"
" & _
"
City:
" & _
"
" & Session("city") & "
" & _
"
" & _
"
" & _
"
State:
" & _
"
" & Session("state") & "
" & _
"
" & _
"
" & _
"
Zip:
" & _
"
" & Session("zip") & "
" & _
"
" & _
"
" & _
"
Phone:
" & _
"
" & Session("phone") & "
" & _
"
" & _
"
" & _
"
Email:
" & _
"
" & Session("email") & "
" & _
"
" & _
"
" & _
"
# of Copies:
" & _
"
" & Session("copies") & "
" & _
"
" & _
"
" & _
"
CC Type:
" & _
"
" & Session("cctype") & "
" & _
"
" & _
"
" & _
"
CC Number:
" & _
"
" & ConvertCardNum(Session.Contents("cc")) & "
" & _
"
" & _
"
" & _
"
Exp. Date:
" & _
"
" & Session.Contents("expdate") & "
" & _
"
" & _
"
" & _
"
Amount Charged:
" & _
"
" & FormatCurrency(Session.Contents("Cost")) & "
" & _
"
" & _
"
"
'send confirmation email
SET Mailer = nothing
SET Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.ContentType = "text/html"
Mailer.FromName = "Surrounded Magazine Confirmation"
Mailer.FromAddress = "surrounded@campbellhall.org"
Mailer.RemoteHost = "smtp.campbellhall.org"
Mailer.AddBCC "Glen Hirshberg", "hirshbg@campbellhall.org"
'Mailer.AddBCC "Carol DeMirjian", "demirjc@campbellhall.org"
'Mailer.AddRecipient "Zac Streelman", "streelz@campbellhall.org"
Mailer.AddRecipient Session.Contents("firstname") & " " & Session.Contents("lastname"), Session.Contents("email")
Mailer.Subject = "Surrounded Magazine Confirmation"
Mailer.BodyText = body
if not Mailer.SendMail then
Mailer.SendMail
else
Response.Write ""
end if
%>
Thank you! You will receive a copy of your registration via email. Please print this page for your records.
<%Response.Write body%>
<%
Conn.Close
SET Conn = Nothing
else
Session.Contents("errormessage") = "Your Credit Card could not be charged. Please verify that all information is accurate."
%>
<%
end if
end if
end if
%>