I'm trying to find out if there is a way to obfuscate the PHP output (html stuff).
basically, I have a few hidden inputs and they have some PHP outputs in them...
Example:
<input type="hidden" name="myinput" value="<?php echo $variable; ?>" />
is there any way to obfuscate its value in the users browser but still readable server side so I can pass the input value between pages?
any suggestion and help would be appreciated.
EDIT: I did it like this:
$string = "my string to be be encrypted goes here";
$secret_key = "This is my secret key";
// Create the initialization vector for added security.
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
// Encrypt $string
$encrypted_string = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $secret_key, $string, MCRYPT_MODE_CBC, $iv);
// Decrypt $string
$decrypted_string = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $secret_key, $encrypted_string, MCRYPT_MODE_CBC, $iv);
echo "Original string : " . $string . "<br />\n";
echo "Encrypted string : " . $encrypted_string . "<br />\n";
echo "Decrypted string : " . $decrypted_string . "<br />\n";