Re: Urgent help required: mcrypt, == causing problems..

From: Date: Tue, 27 May 2003 12:22:00 +0000
Subject: Re: Urgent help required: mcrypt, == causing problems..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149095@lists.php.net to get a copy of this message
Problem solved, much appreciated! I missed the & ;o) "Bix" <php@bix.cc> wrote in message news:20030527121553.72304.qmail@pb1.pair.com... > 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! > >

« previous php.general (#149095) next »