-, JavaScript, , .
PHP: PHP JavaScript ( AJAX.)
, :
encrypt.php
<?php
$password = "KEYVALUE";
$secret_text = "USERID HERE"
$encrypted_text = mcrypt_ecb(MCRYPT_DES, $password, $secret_text, MCRYPT_ENCRYPT);
echo $encrypted_text;
?>
Then you have something called decrypt.php and all that is is to accept the GET argument, and ONLY the output is the decrypted text (HTML code or something else. Technically, you should probably use XML for AJAX, only one value ...)
decrypt.php
<?php
$password = "KEYVALUE";
$decrypted_text = mcrypt_ecb(MCRYPT_DES, $password, $_GET['decrypt'], MCRYPT_DECRYPT);
echo $decrypted_text;
?>
You can check it by calling
decrypt.php? Decrypt = encrypted_string
.
From here, I would call the "decrypt.php? Decrypt = encrypted_string" script from JavaScript, and JavaScript can then read the decrypted value.
A brief introduction to AJAX can be found here: http://www.yourhtmlsource.com/javascript/ajax.html .
source
share