##############################################################################
#                       Credit Card Verifier v1.3                            #
#                      Card Number Format Validator                          #
#                                                                            #
#                         Scripts Archive                                    #
#                    https://worldwidemart.com/scripts/                      #
##############################################################################

DESCRIPTION
-----------
Credit Card Verifier validates credit card numbers using the Luhn algorithm
(mod 10 checksum) and identifies card types based on number prefixes.

⚠️  IMPORTANT SECURITY WARNING ⚠️
---------------------------------
This script ONLY validates the MATHEMATICAL FORMAT of card numbers.

IT DOES NOT:
- Verify the card actually exists
- Check if the card has available credit
- Detect stolen or fraudulent cards
- Process actual payments
- Connect to any bank or card network

For real payment processing, ALWAYS use established payment gateways
like Stripe, PayPal, or Square.

FEATURES
--------
* Luhn algorithm validation
* Card type identification (Visa, MasterCard, Amex, etc.)
* Length validation
* Clean web interface
* Test number examples

REQUIREMENTS
------------
* Unix-based web server with CGI support
* Perl 5.x or higher
* CGI module (usually included)

INSTALLATION
------------
1. Upload ccver.pl to your cgi-bin directory
2. Set permissions: chmod 755 ccver.pl
3. Access via: /cgi-bin/ccver.pl

THE LUHN ALGORITHM
------------------
The Luhn algorithm (mod 10) is a checksum formula created by IBM scientist
Hans Peter Luhn in 1954. It's used to validate:
- Credit card numbers
- IMEI numbers (mobile phones)
- National identification numbers
- Various other ID numbers

How it works:
1. Starting from rightmost digit, double every second digit
2. If doubling gives > 9, subtract 9 (or sum the two digits)
3. Add all the resulting digits
4. If the total is divisible by 10, the number is valid

Example with 4532015112830366:
  4 5 3 2 0 1 5 1 1 2 8 3 0 3 6 6
  8 5 6 2 0 1 1 1 2 2 7 3 0 3 3 6  (doubled digits adjusted)
  Sum = 50 → divisible by 10 → Valid!

CARD TYPE PREFIXES
------------------
Visa:             4xxx (13 or 16 digits)
MasterCard:       51xx-55xx, 2221-2720 (16 digits)
American Express: 34xx, 37xx (15 digits)
Discover:         6011, 65xx, 644-649 (16 digits)
Diners Club:      36xx, 38xx, 300-305 (14 digits)
JCB:              35xx (16 digits)

TEST CARD NUMBERS
-----------------
These numbers pass Luhn validation but are not real cards:

Visa:             4111111111111111
                  4012888888881881
MasterCard:       5500000000000004
                  5105105105105100
American Express: 340000000000009
                  378282246310005
Discover:         6011000000000004
                  6011111111111117

HISTORICAL CONTEXT
------------------
Before modern payment APIs, scripts like this were used to catch obvious
typos before submitting forms. This reduced failed transactions and
improved user experience, but was never meant for security validation.

MODERN ALTERNATIVES
-------------------
For actual payment processing, use established services:

Payment Gateways:
* Stripe (https://stripe.com)
  - Modern API, excellent documentation
  - Handles PCI compliance for you

* PayPal (https://paypal.com)
  - Widely recognized and trusted
  - Multiple integration options

* Square (https://squareup.com)
  - Great for in-person and online
  - Simple fee structure

* Braintree (https://braintreepayments.com)
  - Owned by PayPal
  - Full-featured gateway

For client-side validation (format only):

npm packages:
  npm install card-validator
  npm install credit-card-type

Example:
  import { number } from 'card-validator';
  const validation = number('4111111111111111');
  console.log(validation.isValid); // true
  console.log(validation.card.type); // 'visa'

PCI-DSS COMPLIANCE
------------------
If you handle real credit card data, you MUST comply with PCI-DSS
(Payment Card Industry Data Security Standard). The easiest way is to
use a payment gateway that handles card data on their servers, so you
never touch it directly.

LICENSE
-------
Artistic License

##############################################################################
