|
I'm trying to pass a valid email address as a parameter in the url. [hidden email] in my model it strips the + sign. function confirm($email){ $this->set('email',$email); } confirm.ctp <?php echo $email ?> outputs foo [hidden email] I believe this is happening prior to the controller function getting ahold of the string as I've tried various encoding functions including Security::cipher() at the beginning of the function upon decoding I still get the above output. Can anyone suggest how I might be able to retain the + sign in my controller logic and back out to the view? -- Jon Molesa [hidden email] if you're bored or curious http://rjmolesa.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
The plus sign needs to be url encoded. The plus sign translates to a space when used in the url
Schreck -----Original Message----- From: Jon Molesa <[hidden email]> Date: Mon, 26 Jan 2009 23:19:01 To: CakePHP<[hidden email]> Subject: Passing an email address as param with a plus(+) sign I'm trying to pass a valid email address as a parameter in the url. [hidden email] in my model it strips the + sign. function confirm($email){ $this->set('email',$email); } confirm.ctp <?php echo $email ?> outputs foo [hidden email] I believe this is happening prior to the controller function getting ahold of the string as I've tried various encoding functions including Security::cipher() at the beginning of the function upon decoding I still get the above output. Can anyone suggest how I might be able to retain the + sign in my controller logic and back out to the view? -- Jon Molesa [hidden email] if you're bored or curious http://rjmolesa.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
Upon urldecode though it converts back to a space. *On Tue, Jan 27, 2009 at 04:23:15AM +0000 [hidden email] <[hidden email]> wrote: > Date: Tue, 27 Jan 2009 04:23:15 +0000 > From: [hidden email] > Subject: Re: Passing an email address as param with a plus(+) sign > To: [hidden email] > > The plus sign needs to be url encoded. The plus sign translates to a space when used in the url > Schreck > > -----Original Message----- > From: Jon Molesa <[hidden email]> > > Date: Mon, 26 Jan 2009 23:19:01 > To: CakePHP<[hidden email]> > Subject: Passing an email address as param with a plus(+) sign > > > > I'm trying to pass a valid email address as a parameter in the url. > > [hidden email] > > in my model it strips the + sign. > > function confirm($email){ > $this->set('email',$email); > } > > confirm.ctp > > <?php echo $email ?> > > outputs > > foo [hidden email] > > I believe this is happening prior to the controller function getting > ahold of the string as I've tried various encoding functions including > Security::cipher() at the beginning of the function upon decoding I > still get the above output. Can anyone suggest how I might be able to > retain the + sign in my controller logic and back out to the view? > > -- > Jon Molesa > [hidden email] > if you're bored or curious > http://rjmolesa.com > > > > > -- Jon Molesa [hidden email] if you're bored or curious http://rjmolesa.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
Never mind, thank you Schreck. *On Mon, Jan 26, 2009 at 11:38:44PM -0500 Jon Molesa <[hidden email]> wrote: > Date: Mon, 26 Jan 2009 23:38:44 -0500 > From: Jon Molesa <[hidden email]> > Subject: Re: Passing an email address as param with a plus(+) sign > To: [hidden email] > > > Upon urldecode though it converts back to a space. > > *On Tue, Jan 27, 2009 at 04:23:15AM +0000 [hidden email] <[hidden email]> wrote: > > > Date: Tue, 27 Jan 2009 04:23:15 +0000 > > From: [hidden email] > > Subject: Re: Passing an email address as param with a plus(+) sign > > To: [hidden email] > > > > The plus sign needs to be url encoded. The plus sign translates to a space when used in the url > > Schreck > > > > -----Original Message----- > > From: Jon Molesa <[hidden email]> > > > > Date: Mon, 26 Jan 2009 23:19:01 > > To: CakePHP<[hidden email]> > > Subject: Passing an email address as param with a plus(+) sign > > > > > > > > I'm trying to pass a valid email address as a parameter in the url. > > > > [hidden email] > > > > in my model it strips the + sign. > > > > function confirm($email){ > > $this->set('email',$email); > > } > > > > confirm.ctp > > > > <?php echo $email ?> > > > > outputs > > > > foo [hidden email] > > > > I believe this is happening prior to the controller function getting > > ahold of the string as I've tried various encoding functions including > > Security::cipher() at the beginning of the function upon decoding I > > still get the above output. Can anyone suggest how I might be able to > > retain the + sign in my controller logic and back out to the view? > > > > -- > > Jon Molesa > > [hidden email] > > if you're bored or curious > > http://rjmolesa.com > > > > > > > > > > > -- > Jon Molesa > [hidden email] > if you're bored or curious > http://rjmolesa.com > > Jon Molesa [hidden email] if you're bored or curious http://rjmolesa.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by Schreck
No, that still didn't get it. If I urlencode the string and pass it as a param /users/confirm/foo%2Bbar%40example.com then in users_controller.php function confirm($email){ $email = urldecode($email); $this->set('email',$email); } confirm.ctp <?php echo $email ?> still outputs foo [hidden email] In fact if I leave out the $email = urldecode($email) altogether confirm.ctp still outputs foo [hidden email]. *On Tue, Jan 27, 2009 at 04:23:15AM +0000 [hidden email] <[hidden email]> wrote: > Date: Tue, 27 Jan 2009 04:23:15 +0000 > From: [hidden email] > Subject: Re: Passing an email address as param with a plus(+) sign > To: [hidden email] > > The plus sign needs to be url encoded. The plus sign translates to a space when used in the url > Schreck > > -----Original Message----- > From: Jon Molesa <[hidden email]> > > Date: Mon, 26 Jan 2009 23:19:01 > To: CakePHP<[hidden email]> > Subject: Passing an email address as param with a plus(+) sign > > > > I'm trying to pass a valid email address as a parameter in the url. > > [hidden email] > > in my model it strips the + sign. > > function confirm($email){ > $this->set('email',$email); > } > > confirm.ctp > > <?php echo $email ?> > > outputs > > foo [hidden email] > > I believe this is happening prior to the controller function getting > ahold of the string as I've tried various encoding functions including > Security::cipher() at the beginning of the function upon decoding I > still get the above output. Can anyone suggest how I might be able to > retain the + sign in my controller logic and back out to the view? > > -- > Jon Molesa > [hidden email] > if you're bored or curious > http://rjmolesa.com > > > > > -- Jon Molesa [hidden email] if you're bored or curious http://rjmolesa.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
Try with rawurlencode() On Tue, Jan 27, 2009 at 9:55 AM, Jon Molesa <[hidden email]> wrote: > > No, that still didn't get it. If I urlencode the string and pass it as > a param /users/confirm/foo%2Bbar%40example.com > > then in users_controller.php > > function confirm($email){ > $email = urldecode($email); > $this->set('email',$email); > } > > confirm.ctp > > <?php echo $email ?> > > still outputs > > foo [hidden email] > > In fact if I leave out the $email = urldecode($email) altogether > confirm.ctp still outputs foo [hidden email]. > > *On Tue, Jan 27, 2009 at 04:23:15AM +0000 [hidden email] <[hidden email]> wrote: > >> Date: Tue, 27 Jan 2009 04:23:15 +0000 >> From: [hidden email] >> Subject: Re: Passing an email address as param with a plus(+) sign >> To: [hidden email] >> >> The plus sign needs to be url encoded. The plus sign translates to a space when used in the url >> Schreck >> >> -----Original Message----- >> From: Jon Molesa <[hidden email]> >> >> Date: Mon, 26 Jan 2009 23:19:01 >> To: CakePHP<[hidden email]> >> Subject: Passing an email address as param with a plus(+) sign >> >> >> >> I'm trying to pass a valid email address as a parameter in the url. >> >> [hidden email] >> >> in my model it strips the + sign. >> >> function confirm($email){ >> $this->set('email',$email); >> } >> >> confirm.ctp >> >> <?php echo $email ?> >> >> outputs >> >> foo [hidden email] >> >> I believe this is happening prior to the controller function getting >> ahold of the string as I've tried various encoding functions including >> Security::cipher() at the beginning of the function upon decoding I >> still get the above output. Can anyone suggest how I might be able to >> retain the + sign in my controller logic and back out to the view? >> >> -- >> Jon Molesa >> [hidden email] >> if you're bored or curious >> http://rjmolesa.com >> >> >> >> > > > -- > Jon Molesa > [hidden email] > if you're bored or curious > http://rjmolesa.com > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
Tried that too. Same results. I tried various encodings. Even tired making it a hashed string. But every time I output it the view, the + symbol gets converted to a space. I resolved it by doing a str_replace. That takes care of it, but I'm still curious why it is happening. I'm curious if CakePHP is sanitizing the string prior to output and if there's a way to prevent that from happening. *On Tue, Jan 27, 2009 at 11:48:15AM -0500 brian <[hidden email]> wrote: > Date: Tue, 27 Jan 2009 11:48:15 -0500 > From: brian <[hidden email]> > Subject: Re: Passing an email address as param with a plus(+) sign > To: [hidden email] > > > Try with rawurlencode() > > On Tue, Jan 27, 2009 at 9:55 AM, Jon Molesa <[hidden email]> wrote: > > > > No, that still didn't get it. If I urlencode the string and pass it as > > a param /users/confirm/foo%2Bbar%40example.com > > > > then in users_controller.php > > > > function confirm($email){ > > $email = urldecode($email); > > $this->set('email',$email); > > } > > > > confirm.ctp > > > > <?php echo $email ?> > > > > still outputs > > > > foo [hidden email] > > > > In fact if I leave out the $email = urldecode($email) altogether > > confirm.ctp still outputs foo [hidden email]. > > > > *On Tue, Jan 27, 2009 at 04:23:15AM +0000 [hidden email] <[hidden email]> wrote: > > > >> Date: Tue, 27 Jan 2009 04:23:15 +0000 > >> From: [hidden email] > >> Subject: Re: Passing an email address as param with a plus(+) sign > >> To: [hidden email] > >> > >> The plus sign needs to be url encoded. The plus sign translates to a space when used in the url > >> Schreck > >> > >> -----Original Message----- > >> From: Jon Molesa <[hidden email]> > >> > >> Date: Mon, 26 Jan 2009 23:19:01 > >> To: CakePHP<[hidden email]> > >> Subject: Passing an email address as param with a plus(+) sign > >> > >> > >> > >> I'm trying to pass a valid email address as a parameter in the url. > >> > >> [hidden email] > >> > >> in my model it strips the + sign. > >> > >> function confirm($email){ > >> $this->set('email',$email); > >> } > >> > >> confirm.ctp > >> > >> <?php echo $email ?> > >> > >> outputs > >> > >> foo [hidden email] > >> > >> I believe this is happening prior to the controller function getting > >> ahold of the string as I've tried various encoding functions including > >> Security::cipher() at the beginning of the function upon decoding I > >> still get the above output. Can anyone suggest how I might be able to > >> retain the + sign in my controller logic and back out to the view? > >> > >> -- > >> Jon Molesa > >> [hidden email] > >> if you're bored or curious > >> http://rjmolesa.com > >> > >> > >> > >> > > > > > -- > > Jon Molesa > > [hidden email] > > if you're bored or curious > > http://rjmolesa.com > > > > > > > > > Jon Molesa [hidden email] if you're bored or curious http://rjmolesa.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
What does $email look like before you use set()? I don't think the problem's there but you'll need to backtrack. I just did a test and didn't see any change in the value between controller and view when I used '@' or '%2B'. I'm sure the issue lies before your confirm() method. On Tue, Jan 27, 2009 at 11:57 AM, Jon Molesa <[hidden email]> wrote: > > Tried that too. Same results. I tried various encodings. Even tired > making it a hashed string. But every time I output it the view, the + > symbol gets converted to a space. I resolved it by doing a str_replace. > That takes care of it, but I'm still curious why it is happening. I'm > curious if CakePHP is sanitizing the string prior to output and if > there's a way to prevent that from happening. > > *On Tue, Jan 27, 2009 at 11:48:15AM -0500 brian <[hidden email]> wrote: > >> Date: Tue, 27 Jan 2009 11:48:15 -0500 >> From: brian <[hidden email]> >> Subject: Re: Passing an email address as param with a plus(+) sign >> To: [hidden email] >> >> >> Try with rawurlencode() >> >> On Tue, Jan 27, 2009 at 9:55 AM, Jon Molesa <[hidden email]> wrote: >> > >> > No, that still didn't get it. If I urlencode the string and pass it as >> > a param /users/confirm/foo%2Bbar%40example.com >> > >> > then in users_controller.php >> > >> > function confirm($email){ >> > $email = urldecode($email); >> > $this->set('email',$email); >> > } >> > >> > confirm.ctp >> > >> > <?php echo $email ?> >> > >> > still outputs >> > >> > foo [hidden email] >> > >> > In fact if I leave out the $email = urldecode($email) altogether >> > confirm.ctp still outputs foo [hidden email]. >> > >> > *On Tue, Jan 27, 2009 at 04:23:15AM +0000 [hidden email] <[hidden email]> wrote: >> > >> >> Date: Tue, 27 Jan 2009 04:23:15 +0000 >> >> From: [hidden email] >> >> Subject: Re: Passing an email address as param with a plus(+) sign >> >> To: [hidden email] >> >> >> >> The plus sign needs to be url encoded. The plus sign translates to a space when used in the url >> >> Schreck >> >> >> >> -----Original Message----- >> >> From: Jon Molesa <[hidden email]> >> >> >> >> Date: Mon, 26 Jan 2009 23:19:01 >> >> To: CakePHP<[hidden email]> >> >> Subject: Passing an email address as param with a plus(+) sign >> >> >> >> >> >> >> >> I'm trying to pass a valid email address as a parameter in the url. >> >> >> >> [hidden email] >> >> >> >> in my model it strips the + sign. >> >> >> >> function confirm($email){ >> >> $this->set('email',$email); >> >> } >> >> >> >> confirm.ctp >> >> >> >> <?php echo $email ?> >> >> >> >> outputs >> >> >> >> foo [hidden email] >> >> >> >> I believe this is happening prior to the controller function getting >> >> ahold of the string as I've tried various encoding functions including >> >> Security::cipher() at the beginning of the function upon decoding I >> >> still get the above output. Can anyone suggest how I might be able to >> >> retain the + sign in my controller logic and back out to the view? >> >> >> >> -- >> >> Jon Molesa >> >> [hidden email] >> >> if you're bored or curious >> >> http://rjmolesa.com >> >> >> >> >> >> >> >> > >> > >> > -- >> > Jon Molesa >> > [hidden email] >> > if you're bored or curious >> > http://rjmolesa.com >> > >> > > >> > >> >> > -- > Jon Molesa > [hidden email] > if you're bored or curious > http://rjmolesa.com > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by Jon Molesa
So I know this post happened nearly 3 years ago, but this really stumped me for a good while. The final solution I came up with was to triple encode the email address before passing it to the URL like so:
$enc_email = urlencode(urlencode(urlencode('[hidden email]'))); This in turn would get put into the URL: http://example.com/email/confim/foo%25252Bbar%252540example.com/ After all of the URL processing magic, the email finally gets put into CakePHP correctly. Now why CakePHP requires this be done is somewhat a mystery to me, but the best thing I can come up with is that it's not all CakePHP's fault. The best thing I can come up with is that this maybe http server or apache configuration specific. It could even be different from distro of linux to distro of linux. It seems that some installs of apache require you to double encode the '+', '\', or '/' variables in order to process them correctly. This was probably designed to prevent some sort of security breach. Please see the following link for more info: http://www.jampmark.com/web-scripting/5-solutions-to-url-encoded-slashes-problem-in-apache.html The final encoding is probably required for CakePHP. Although I can't find it in the code, I am sure CakePHP decodes all URL variables again somewhere. Hopefully this will help prevent any frustration for someone in the future. -Matt Brooks On Monday, January 26, 2009 10:19:01 PM UTC-6, Jon Molesa wrote: I'm trying to pass a valid email address as a parameter in the url.-- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
| Powered by Nabble | Edit this page |
