"
MYSQL = "EXEC WEB_GetOnlineCart @array='" & session("cartArray") & "'"
rs.Open MYSQL, Conn
if not rs.EOF then
While NOT rs.eof
Tbl_description = rs("description")
Tbl_packageid = rs("packageid")
Tbl_packname = rs("Name")
Tbl_updprice = rs("updateprice")
Tbl_packprice = rs("price")
Tbl_loyaltyprice = rs("loyaltyprice")
Tbl_productID = rs("productID")
Tbl_user = rs("defaultUserCount")
Tbl_xtraUser = rs("extrauserprice")
Tbl_familyID = rs("familyID")
infoBtn = ""
'Any mention of Exampro is removed to avoid needless repetition
Tbl_packname = "" & Replace(rs("Name"),"Exampro","") & ""
dropdown = ""
'here we check if the Update button has been clicked. if it has then a new session is created from the drop-down value, if not (if the schools contact form is submitted and returns an error), the old session remains
if request("updFormBtn" & Tbl_packageid) = "update" then
session("extrasInput" & Tbl_packageid)= request("extrasDrop" & Tbl_packageid)
else
session("extrasInput" & Tbl_packageid)= session("extrasInput" & Tbl_packageid)
end if
session("extrasPrice" & Tbl_packageid) = session("extrasInput" & Tbl_packageid) * Tbl_xtraUser
quantArray = quantArray & "," & session("extrasInput" & Tbl_packageid)
if Left(quantArray,1) = "," then quantArray = Right(quantArray, Len(quantArray) -1)
if Right(quantArray,1) = "," then quantArray = Left(quantArray, Len(quantArray) -1)
if InStr(session("cartArray"),Tbl_productID) > 0 then
cartCheck = ""
else
cartCheck = ""
end if
rs.MoveNext
'========== begin MfL stuff
'count how many MfLprods have been ordered. Discount if 3 or more, but not tracker
if( (Tbl_familyID = 5) and (Tbl_productID <> "PK_EP_146") ) then
MfLprods = MfLprods + 1
end if
if (Tbl_productID = "PK_EP_142") or (Tbl_productID = "PK_EP_143") or (Tbl_productID = "PK_EP_145") then
Tbl_user = ""
end if
if(Tbl_productID = "PK_EP_146") then
Tbl_user = "250MB"
packagerows = packagerows & "
"
packagerows = packagerows & pagerowsTotal
if Len(session("cartArray")) < 1 then
response.Redirect("pro_order.asp")
end if
'---------------------------------------------------
' Set the default labels for fields
'---------------------------------------------------
fullNameLabel = "Contact name:"
addressLabel = "Centre address:"
postCodeLabel = "Postcode:"
positionLabel = "Your position:"
despatchLabel = "Email my licence"
emailLabel = "Centre email: (for log-in details)"
emailLabel2 = "Re-enter email:"
countrylabel = "Country:"
financeLabel = "Finance email:"
financeLabel2 = "Re-enter email:"
'-------------------------------------
'set the validation flags for later
'-------------------------------------
errFlag = 0
errFlag2 = 0
mailFlag = 0
emailerr = 0
financeerr = 0
'------------------------------------------------
'SC is the DFES number from the search results
'------------------------------------------------
'---------------------------------------------------
' Get the single school if there is a DFES
'---------------------------------------------------
SC = request("sc")
PROG_price = 1000
havebought = ""
packname = ""
if Len(SC) > 1 then session("SC") = SC
SC = session("SC")
MYSQL = "EXEC WEB_CheckIfOrderedOnline @SC='" & SC & "' "
rs.Open MYSQL, Conn
while not rs.EOF
packageid = rs("packageid")
packname = rs("Name")
updprice = rs("updateprice")
packprice = rs("price")
loyaltyprice = rs("loyaltyprice")
purchaseCount = rs.RecordCount
if purchaseCount = -1 then
havebought = "Thank you for renewing your annual licence"
else
havebought = ""
end if
rs.MoveNext
Wend
rs.close
if Len(sc) > 4 then
returnString = "This is not my centre, return to the post code search."
MYSQL = "EXEC GetSingleSchool @dfes='" & SC & "'"
rs.Open MYSQL, DataConn
if not rs.EOF then
'email = rs("email")
addressComplete = rs("addressComplete")
postCode = rs("postCode")
dfes = rs("dfes")
org = rs("org")
telephone = rs("telephone")
'fax = rs("fax")
end if
rs.close
end if
showOrderOptions = 1
if request("clicked") = "1" then
email = request("email")
email2 = request("email2")
financeemail = request("financeemail")
financeemail2 = request("financeemail2")
addressComplete = request("addressComplete")
postCode = request("postCode")
dfes = request("dfes")
org = request("org")
telephone = request("telephone")
fullname = request("fullname")
maildespatch =request("mailDespatch")
schoolOrder=request("schoolOrder")
vat = request("vat")
agreeTerms = request("agreeTerms")
promo_code = request("promo_code")
promo_source = request("promo_sourceform")
'------------------------
' Here are the products
'------------------------
productArray = session("cartArray")
'------------------------
' validate user entry
'------------------------
fullname = validate(request("fullname"))
org = validate(request("org"))
addressComplete = validate(request("addressComplete"))
postCode = validate(request("postCode"))
position = validate(request("position"))
job = validate(request("job"))
dfes = validate(request("dfes"))
vat = validate(request("vat"))
schoolOrder = validate(request("schoolOrder"))
telephone = validate(request("telephone"))
email = validate(request("email"))
email2 = validate(request("email2"))
financeemail = validate(request("financeemail"))
promo_code = validate(request("promo_code"))
promo_source = validate(request("promo_sourceform"))
if email <> email2 then
emailerr = 1
end if
if financeemail <> financeemail2 then
financeerr = 1
end if
if request.form("agreeTerms") <> "" Then
errFlag2 = 0
agreeTerms = "1"
else
errFlag2 = 1
end if
if Len(ProductArray) < 2 then
errFlag = 1
response.redirect("OrderForm.asp?er=1")
end if
if Len(fullname) < 2 then
errFlag = 1
fullNameLabel = "Contact Name:"
'CountryLabel = "Country:"
errtext = "Please include your contact name. "
end if
if country = "0" then
errFlag = 1
countrylabel = "Country:"
end if
if Len(addressComplete) < 10 then
errFlag = 1
addressLabel = "Centre address:"
end if
if Len(postcode) < 4 then
errFlag = 1
postCodeLabel = "Postcode:"
end if
if Len(email) < 5 then
'errFlag = 1
if InStr(email,"@") = 0 or InStr(email,".") = 0 then
errFlag = 1
emailLabel = "Centre email: (for log-in details)"
end if
end if
if Len(email) > 2 then
if InStr(email,"@") = 0 or InStr(email,".") = 0 then
mailFlag = 1
emailLabel = "Email address: (for log-in details)"
end if
end if
if Len(financeemail) < 5 then
'errFlag = 1
if InStr(financeemail,"@") = 0 or InStr(financeemail,".") = 0 then
financeerr = 1
financeLabel = "Finance email:"
end if
end if
if Len(financeemail) > 2 then
if InStr(financeemail,"@") = 0 or InStr(financeemail,".") = 0 then
financeerr = 1
'financeLabel = "Please provide an email address for your finance department:"
end if
end if
if mailDespatch = "1" and (mailflag = 1) then
mailFlag = 1
emailLabel = "Email address: (for log-in details)"
despatchLabel = "send me my licence via email"
end if
emailhighlight = ""
financefail = ""
emailfail = "#999999"
if errFlag2 = 1 then errText2="You must agree to the Conditions of Order "
if mailFlag = 1 and errFlag = 1 then errText = errText & "Email address is not valid. "
if mailFlag = 1 and errFlag = 0 then errText = errText & "Email address is not valid. "
if emailerr = 1 then
emailfail = "red"
errText = errText & "Emails do not match. "
emailLabel = "Email address: (for log-in details)"
emailLabel2 = "Re-enter email:"
end if
if Len(email) = 0 then
errFlag = 1
errText = errText & "An email address is required. "
emailLabel = "Email address: (for log-in details)"
end if
if len(job) < 2 then
errflag = 1
errtext = errtext & "Please include your position. "
positionLabel = "Your position:"
end if
if financeerr = 1 then
financefail = "red"
financeLabel = "Finance email:"
financeLabel2 = "Re-enter email:"
financehighlight="finance emails do not match"
errText = errText & "A valid finance email address is required."
end if
'-------------------------------------
'--- Process / save the order here
'-------------------------------------
if errFlag = 0 AND mailFlag = 0 AND errFlag2 = 0 AND emailerr = 0 AND financeerr = 0 then
'----------------------------------------
'Create the MD5 string for this order
'----------------------------------------
Set L = Server.CreateObject("MD5.Encode")
MD5 = L.Process(date() & time() & fullname & postcode & session.sessionID)
Set L = nothing
'-------------------------------------
'Set the vars to support apostrophes
'-------------------------------------
session("MyArray") = MyArray
MyArray = split(session("cartArray"),",")
'MyArray = Array(session("cartArray"))
max=ubound(MyArray)'
For i=0 to max
For j=i+1 to max
if MyArray(i)>MyArray(j) then
TemporalVariable=MyArray(i)
MyArray(i)=MyArray(j)
MyArray(j)=TemporalVariable
end if
next
next
email = LEFT(replace(request("email"),"'","''"),50)
addressComplete = LEFT(replace(request("addressComplete"),"'","''"),1000)
postCode = LEFT(replace(request("postCode"),"'","''"),20)
dfes = LEFT(replace(request("dfes"),"'","''"),20)
vat = LEFT(replace(request("vat"),"'","''"),20)
org = LEFT(replace(request("org"),"'","''"),500)
telephone = LEFT(replace(request("telephone"),"'","''"),50)
fullname = LEFT(replace(request("fullname"),"'","''"),100)
maildespatch =request("mailDespatch")
confirmMail = request("confirmMail")
schoolOrder=replace(request("schoolOrder"),"'","''")
productArray = replace(session("cartArray")," ","")
country = request("country")
financeemail = LEFT(replace(request("financeemail"),"'","''"),100)
job = LEFT(replace(request("job"),"'","''"),50)
agreeTerms = request("agreeTerms")
quantArray = replace(quantArray," ","")
totalquantArray = replace(totalquantArray," ","")
promo_code=replace(request("promo_code"),"'","''")
promo_source=request("promo_sourceform")
'----------------------
'save to the database
'----------------------
IP = Request.ServerVariables("REMOTE_ADDR")
UA = Request.ServerVariables("HTTP_USER_AGENT")
MySql = "EXEC submitPackageOrder " 'used to be PackageOrderSP
MySql = MySql & "@org = '" & org & "',"
MySql = MySql & "@job = '" & job & "',"
MySql = MySql & "@dfes = '" & dfes & "',"
MySql = MySql & "@postcode = '" & postcode & "',"
MySql = MySql & "@telephone = '" & telephone & "',"
MySql = MySql & "@vat = '" & vat & "',"
MySql = MySql & "@fullname = '" & fullname & "',"
MySql = MySql & "@email = '" & email & "',"
MySql = MySql & "@financeemail = '" & financeemail & "',"
MySql = MySql & "@mailingAddress = '" & addressComplete & "',"
MySql = MySql & "@agreeTerms = '" & agreeTerms & "',"
MySql = MySql & "@ArrayProducts = '" & join(MyArray,",") & "',"
MySql = MySql & "@quantArray = '" & quantArray & "',"
MySql = MySql & "@totalquantArray = '" & totalquantArray & "',"
MySql = MySql & "@maildespatch = '" & maildespatch & "',"
MySql = MySql & "@MD5 = '" & MD5 & "',@confirmMail = '" & confirmMail & "',"
MySql = MySql & "@IP = '" & IP & "',"
MySql = MySql & "@UA = '" & UA & "',@site='" & session("site") & "',@schoolOrder='" & schoolOrder & "',@country='" & country & "',"
MySql = MySql & "@promo_code = '" & promo_code & "',"
MySql = MySql & "@promo_source = '" & promo_source & "'"
rs.Open MYSQL, DataConn
Set DataConn = nothing
'-------------------------------------
'clear the user session and redirect
'-------------------------------------
'session.abandon
response.redirect("confirmPackageOrder.asp?s=" & MD5)
end if
end if
progbar = ""
Session.Timeout=500
%>
Exampro - Order Exampro today