Written in Miva version 3.57 (http://www.miva.com). Save this file as CC_Typo_Trap.mv in the MivaDocumentRoot on your secure Miva server. Please, never accept or manipulate unencrypted credit card numbers on an insecure Miva server. Uncomment the MvEXIT at the top of this file before uploading to the web. (Doing so will ensure this function is only avaliable by MvDOing from scripts stored in your domain, on your secure Miva server.) Brian R. Bullock brian@wwwebweaver.com http://wwwebweaver.com/func_junc/functions.html Released to the public domain May 22, 2001 ====================================================================== This function verifies the accuracy of an entered credit card number for MasterCard, Visa, AmEx, Discover, DinersClub, enRoute and JCB credit card accounts. It does not process, store or in any way validate that the credit card number refers to a real credit account or if that hypothetical account contains any money. What it does do is check card numbers using the Luhn Check Digit Algorithm to verify the number is formatted correctly. It also checks the prefix and length of the card number against strict standards published by the credit card companies. Its sole purpose is to trap typographical errors before you submit the credit card number to your Ecommerce provider. The Credit card number can also be automatically encrypted using my MvAES library (http://wwwebweaver.com/func_junc/functions.html) so that you can safely store it in an insecure environment or send it through email. I have made a diligent effort to verify that the information this function uses is both accurate and up to date but I do not accept any liability if it is not. ====================================================================== Function Usage Notes ====================================================================== Function Name: CC_Typo_Trap() Parameters: CardName : Either MasterCard, Visa, AmEx, DinersClub, Discover, enRoute or JCB (case insensitive but spelling must be exact). CardNumber : The credit card account number. May contain spaces, dashes and other non-digit characters. Sample code : Function Return value: If the number IS NOT accurate then the function returns a null and the global variable 'cc_typo_trap_error' will contain an error message. If the number IS accurate then the function returns a 1 if you are not using the automatic encryption option and the encrypted card number if you are using automatic encryption. Using Automatic Card Number Encryption: 1) Download and store the MvAES library on both your online secure Miva server's MivaDocumentRoot and your local computer's Miva Mia MivaDocumentRoot. 2) Use the MvAES library on your local computer to generate a secret key. a) Cut-n-paste the secret key into the l.Secret_Key assignment in line 4 of the CC_Typo_Trap function below. b) Save the secret key in a secure place on your local computer. You'll need it later to decrypt the credit card numbers on your local machine. 3) Type the path to the online copy of MvAES.mv into the l.MvAES_Path assignment in line 5 of the CC_Typo_Trap function below. If you uploaded it to the online MivaDocumentRoot then type in: /MvAES.mv 4) Uncomment the MvEXIT at the top of this script then upload it to the MivaDocumentRoot of your online secure Miva server. This function will then be ready to be MvDOne by the script that collects the customers information. If the credit card number is accurate this function will return the encrypted number so it can be saved in database or emailed to you. __________________ Start of HTML Demo Code __________________

Enter the card name (MasterCard, Visa, AmEx, DinersClub, Discover, enRoute or JCB):

Enter the card number:

___________ End of HTML Demo Code ______________