At no point are any of the card details validated. In
fact, this class will work perfectly well with empty strings for any properties. This is so the class can remain
as versatile as possible. It is more likely that credit card details will be validated as part of the UI used to
enter them, or even not at all. This isn??™t at all dangerous??”if invalid details are used, then the credit card
transaction will simply fail, and we handle that using very similar logic to that required when dealing with
a lack of funds (that is, we notify the customer of failure and ask them to try another card). Of course, there
are also simple data-formatting issues (dates are usually MM/YY, for example), but as noted, these can be
dealt with externally to the SecureCard class.
The test page (test_card.php) for this class simply allows you to see how an encrypted card looks. As you can
see, quite a lot of data is generated, which is the reason for the rather large column size in the customer database.
You can also see that both encryption and decryption are working perfectly, so you can now move on to the customer
account section of this chapter.
Adding Customer Accounts Functionality to
TShirtShop
Before implementing the visual bits of the customer accounts functionality, let??™s preview what
we??™re going to do in the final part of this chapter.
We want to have a login form on the front of the site.
Pages:
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622