Prev | Current Page 605 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

Public members are part of the public interface of the class, which
provides the functionality for external clients. LoadEncryptedDataAndDecrypt() receives an encrypted string
and performs the decryption; LoadPlainDataAndEncrypt() receives the credit card data in plain format and
encrypts it:
CHAPTER 16 ?–  MANAGING CUSTOMER DETAILS 495
// Decrypt data
public function LoadEncryptedDataAndDecrypt($newEncryptedData)
{
$this->_mEncryptedData = $newEncryptedData;
$this->DecryptData();
}
// Encrypt data
public function LoadPlainDataAndEncrypt($newCardHolder, $newCardNumber,
$newIssueDate, $newExpiryDate,
$newIssueNumber, $newCardType)
{
$this->_mCardHolder = $newCardHolder;
$this->_mCardNumber = $newCardNumber;
$this->_mIssueDate = $newIssueDate;
$this->_mExpiryDate = $newExpiryDate;
$this->_mIssueNumber = $newIssueNumber;
$this->_mCardType = $newCardType;
$this->EncryptData();
}
The main work is carried out by the private EncryptData() and DecryptData() methods, which you??™ll come
to shortly. First you have two utility methods for packaging and unpackaging data in XML format (which makes it
easier to get at the bits you want when exchanging data with the encrypted format).
XML is a very powerful, tag-based format in which you can store various kinds of information. The SecureCard
class stores a customer??™s credit card data in a structure like the following:


Pages:
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
Nike Buty Męskie Air Flex Trainer Lea booking Biżuteria swarovskiego remont warszawa grzejniki łazienkowe