%
'=========================================================
'USAGE:
'errorForm "Please enter the check number", "checkout.asp"
'=========================================================
SUB errorForm( errorMSG, backpage )
%>
Nyakio.com: Shopping Cart
There was a problem with the information you entered:
<%=errorMSG%>
|
<%
Response.End
END SUB
FUNCTION invalidEmail( email )
IF INSTR( email, "@" ) = 0 OR INSTR( email, "." ) = 0 THEN
invalidEmail = TRUE
ELSE
invalidEmail = FALSE
END IF
END FUNCTION
function CheckCC(CCNo)
Dim i, w, x, y
y = 0
CCNo = Replace(Replace(Replace(CStr(CCNo), "-", ""), " ", ""), ".", "") 'Ensure proper format of the input
'Process digits from right to left, drop
' last digit if total length is even
w = 2 * (Len(CCNo) Mod 2)
For i = Len(CCNo) - 1 To 1 Step -1
x = Mid(CCNo, i, 1)
if IsNumeric(x) Then
Select Case (i Mod 2) + w
Case 0, 3 'Even Digit - Odd where total length is odd (eg. Visa vs. Amx)
y = y + CInt(x)
Case 1, 2 'Odd Digit - Even where total length is odd (eg. Visa vs. Amx)
x = CInt(x) * 2
if x > 9 Then
'Break the digits (eg. 19 becomes 1 + 9)
'
y = y + (x \ 10) + (x - 10)
Else
y = y + x
End if
End Select
End if
Next
'Return the 10's complement of the total
'
y = 10 - (y Mod 10)
if y > 9 Then y = 0
CheckCC = (CStr(y) = Right(CCNo, 1))
End function
session("x_card_num") = Request ("x_card_num")
session("x_exp_date") = Request ("x_exp_date")
session("x_first_name") = Request ("x_first_name")
session("x_last_name") = Request ("x_last_name")
session("x_address") = Request ("x_address")
session("x_city") = Request ("x_city")
session("x_state") = Request ("x_state")
session("x_zip") = Request ("x_zip")
session("x_email") = Request ("x_email")
'if Request("Response Code") = 1 then
code = Request("x_response_code")
%>
<%
if code<>1 THEN
%>Invalid data was submitted. Please go back and correct the information.<%
ELSE
%>