Encrypting id varible being passed in the url? |
[eluser]Unknown[/eluser]
Hey guys, I'm looking to use codeigniters encryption class to encrypt a user id and then decrypt on the server. The trouble I'm having seems to be to do with codeigniters permitted uri characters.. Sometimes the id will encrypt to a long string like: b4ec6/2qZeu1tq70+1H20GOzbkiRsQ8HqZ6BSqzB1uzdiybwPKdnEpWfovuq16CFR8Zf+OUHn/on0c7zJ/rQQA== Which as you can see contains the + symbol. I've noticed when it encrypts to a string with the + symbol in it, it doesn't work. If i put it in the url like this: www.domainname.com/?id=b4ec6/2qZeu1tq70+1H20GOzbkiRsQ8HqZ6BSqzB1uzdiybwPKdnEpWfovuq16CFR8Zf+OUHn/on0c7zJ/rQQA== When I do this on the server side: (just to test what I'm getting) echo $id = $_GET['id']; It displays like this: (with the + symbols replaced with spaces) b4ec6/2qZeu1tq70 1H20GOzbkiRsQ8HqZ6BSqzB1uzdiybwPKdnEpWfovuq16CFR8Zf OUHn/on0c7zJ/rQQA== My decryption works fine when there are no + symbols in there. I've done this.. $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\- +'; Am I missing something? Am I even on the right track with how to encrypt a user id in the url? Any help at all would be really appreciated. Sorry if I haven't explained clearly enough =( Thanks! |
Welcome Guest, Not a member yet? Register Sign In |