Prev | Current Page 598 | Next

Emilian Balanescu and Cristian Darie

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

Add a test file in the tshirtshop folder called test_encryption.php with the following code:
if (isset ($_GET['my_string']))
{
require_once 'include/config.php';
require_once BUSINESS_DIR . 'symmetric_crypt.php';
$string = $_GET['my_string'];
echo 'The string is:
' . $string . '

';
$encrypted_string = SymmetricCrypt::Encrypt($string);
echo 'Encrypted string:
' . $encrypted_string . '

';
$decrypted_string = SymmetricCrypt::Decrypt($encrypted_string);
echo 'Decrypted string:
' . $decrypted_string;
}
?>




Enter string to encrypt:




3. Load the newly created test_encryption.php file in your favorite browser, and give a string to
encrypt/decrypt (see Figure 16-2).
?– Note Usually XAMPP comes without the mcrypt library configured; therefore, you??™ll receive a fatal error
about the call to the mcrypt_encrypt() function when testing test_encryption.php. You have to configure
PHP to load the mcrypt library. To achieve this, uncomment the following line from php.ini by deleting
the ; from the start of the line, as shown here:
extension=php_mcrypt.dll
You??™ll find the php.ini file in the C:\xampp\apache\bin\ folder on Windows or the /opt/lampp/etc
folder on Linux.


Pages:
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
włatcy móch regeneracja tonerów wentylacja linki sponsorowane noclegi w górach