Welcome Guest, Not a member yet? Register   Sign In
Issue with plus symbol when getting the value
#1

[eluser]CocoMansur[/eluser]
i have an issue with the plus symbol when getting the value from a link.

The value i get is encrypted, but when i test to decode the value, it does't decode using same encryption key.

This is what happens:

here is the link,

Quote:url/?t=Jp9z7u7RcnUkdnT5X+qO3q6I5pqeb8Lv4BO2Jg4neuznq6Gn0yuDsiDTTejEN01Duk9Np+i7bPm0|JfW|vaAvVaA==

when i get the value of t to decode, it shows blank or is empty,

but if i display the value withouth decoding it, it shows

Quote:Jp9z7u7RcnUkdnT5X qO3q6I5pqeb8Lv4BO2Jg4neuznq6Gn0yuDsiDTTejEN01Duk9Np i7bPm0|JfW|vaAvVaA==

notice that the + symbol changes to a white space,

i temporarily have a work arround it by using
Code:
str_ireplace().

why is it changing to white space?
#2

[eluser]InsiteFX[/eluser]
./application/config/config.php

Code:
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify with a regular expression which characters are permitted
| within your URLs.  When someone tries to submit a URL with disallowed
| characters they will get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
//$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-+&?';

Sometimes you will need to extend the URI class to modify it.
#3

[eluser]CocoMansur[/eluser]
i tried that already and it didn't work.
#4

[eluser]CroNiX[/eluser]
I wouldn't pass something like that via the url in the first place. Where is that value coming from? The db? I'd pass an ID instead of the value and then look up the value in the controller. Or don't send it via GET.

It's most likely because spaces normally get translated to +'s in the url. That's normal. Try submitting a form using GET with a field value of "This is a url". After submit the url would be something like http://yoursite.com/something?value=This+is+a+url. Then when you retrieve $_GET['value'], it translates it back to "This is a url", converting +'s back to spaces. Normal web behavior. Google "url encoding" if you are unfamiliar.

Again, I wouldn't pass something like that in the url (GET) as you will get unexpected results with certain web-safe symbols, like you are.




Theme © iAndrew 2016 - Forum software by © MyBB