Urgent help required: mcrypt, == causing problems..
| From: | Bix | Date: | Tue, 27 May 2003 12:14:03 +0000 |
| Subject: | Urgent help required: mcrypt, == causing problems.. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149092@lists.php.net to get a copy of this message | ||
I have the following encryption and decryption functions:
function encrypt($data,$subkey = ""){
$key = $GLOBALS['cryptkey'] . $subkey;
$iv = substr(md5($key), 0, mcrypt_get_iv_size (MCRYPT_3DES,
MCRYPT_MODE_ECB));
$output = mcrypt_encrypt (MCRYPT_3DES, $key, $data, MCRYPT_MODE_ECB, $iv);
$output = trim(chop(base64_encode($output)));
return $output;
}
function decrypt($data,$subkey = ""){
$key = $GLOBALS['cryptkey'] . $subkey;
$data = base64_decode($data);
$iv = substr(md5($key), 0, mcrypt_get_iv_size (MCRYPT_3DES,
MCRYPT_MODE_ECB));
$output = mcrypt_decrypt (MCRYPT_3DES, $key, $data, MCRYPT_MODE_ECB, $iv);
$output = trim($output);
return $output;
}
I use these to send confirmation emails to users of the site, when i send
the emails, i use urlencode and urldecode to make the URLs work.
These work fine if i have only one GET value to pass ie:
www.site.com/script.php?var1=dsjhgsbgkjbasduih349856ysdja==
however, if i try and add another variable to the end of the url, my script
cannot see it since the encrypted output has == at the end of it....
www.site.com/script.php?var1=fsdjhngsdngk3468309476==var2=sajdbgfsbdghbsd478
634
if i try and pick up $_GET['var2'] it is not seen, but $_GET['var1'] shows
fsdjhngsdngk3468309476==var2=sajdbgfsbdghbsd478634
Any ideas? Any help would be much appreciated! Thanks!