Home arrow PHP arrow Page 6 - Creating a Credit Card Validation Class With PHP

Creating a Credit Card Validation Class With PHP

One of the most important functions of any eCommerce web site is credit card number storage and validation. In this article David develops a PHP class that stores the details of a credit card and validates its number using the Mod 10 algorithm.

Author Info:
By: David Rusik
Rating: 5 stars5 stars5 stars5 stars5 stars / 48
February 25, 2002
  1. · Creating a Credit Card Validation Class With PHP
  2. · Credit card validation
  3. · Creating the CCreditCard class
  4. · Creating the CCreditCard class (contd.)
  5. · Using our CCreditCard class
  6. · Conclusion

print this article

Creating a Credit Card Validation Class With PHP - Conclusion
(Page 6 of 6 )

In this article we've seen how we can take advantage of PHP's object orientated nature (most notably classes) to create a credit card storage and validation class. We went through the components of this class in detail, and we finished off by creating a test script in which we instantiated our CCreditCard class and validated a sample card number.

If you're thinking of setting up an eCommerce site which will process/store visitors credit card details, then you should take the class we've just made and customize it to suit your needs. You might want to add other functions to it to compare CCreditCard objects, format the cards details into an XML string, encrypt the cards details to a database, or even process the payment in real time.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus

- Removing Singletons in PHP
- Singletons in PHP
- Implement Facebook Javascript SDK with PHP
- Making Usage Statistics in PHP
- Installing PHP under Windows: Further Config...
- File Version Management in PHP
- Statistical View of Data in a Clustered Bar ...
- Creating a Multi-File Upload Script in PHP
- Executing Microsoft SQL Server Stored Proced...
- Code 10x More Efficiently Using Data Access ...
- A Few Tips for Speeding Up PHP Code
- The Modular Web Page
- Quick E-Commerce with PHP and PayPal
- Regression Testing With JMeter
- Building an Iterator with PHP

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials