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. |