I am a newbie in programming and in need of help with PHP. I have a code that is use to decrypt a string. The problem is it only show the decrypted first variable in the function(decriptInfoDetails). What need to be change so it can also shows the 2nd and 3rd variable in the function? Also is there a better way of doing this for example if I have more variable to decrypt say 10 or more? I attach the code below for viewing purpose. Hope somebody can help this newbie, and thanks in advance.
<?
$privateKey = "xxxxx";
$iv = "xxxxx";
$keyPassword = "xxxxx";
$ivPassword = "xxxxx";
function decriptInfoDetails($ciphertext_base64){
global $privateKey,$iv;
$ciphertext_dec = trim(base64_decode($ciphertext_base64));
$plaintext_utf8_dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $privateKey,
$ciphertext_dec, MCRYPT_MODE_CBC, $iv);
return trim($plaintext_utf8_dec);
}
function encPass($ciphertext_base64){
global $keyPassword,$ivPassword;
$ciphertext_dec = trim(base64_decode($ciphertext_base64));
$plaintext_utf8_dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $keyPassword,
$ciphertext_dec, MCRYPT_MODE_CBC, $ivPassword);
return trim($plaintext_utf8_dec);
}
function encAndDecPass($data){
global $keyPassword,$ivPassword;
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $keyPassword, $data, MCRYPT_MODE_CBC, $ivPassword);
$ciphertext_base64 = trim(base64_encode($encrypted));
return trim($ciphertext_base64);
}
echo decriptInfoDetails("D8D6OsHciT/rBfeNMGrwtQZegzDv02dTnotroNOe+Kk=","ojPlxa16CVhoLq8GP8d0h5l+Z+5GqFXSWXaX7GSXC/Q=1","zrJCOomZ4CJIeBTomAb9OGq2pQK17FBGqVNFdVawPB8=1");
?>