Welcome Guest, Not a member yet? Register   Sign In
Use encrypt helper,how to
#1

[eluser]chmod[/eluser]
I use CI's encrypt helper.

Code:
$datetime = date('Y-m-d H:i:s',time());
$keycode = $game_id.'|'.$area_id.'|'.$datetime;
$sid = $this->encrypt->encode($keycode);         $this->session->set_userdata('sid',$sid);


and the result of $sid maybe include following character :
space
+
=

when I use get pass $sid,the space character will be translate:
hexadecimal ,so the encrypt result will not equal.

If i want use enctypt helper ,but wipe out the space or + or =,how can I do?
#2

[eluser]Pascal Kriete[/eluser]
base64 encode the result, or if it's not critical data just base64 encode it from the start.
#3

[eluser]chmod[/eluser]
thanks,inparo

do you mean:
i use base64_encode($sid), and pass it to url,isn't it?
#4

[eluser]Pascal Kriete[/eluser]
Yes. However, if it's sensitive data you might have to do both. If you're storing it in the session anyways you could probably find a post free workaround as well.
#5

[eluser]chmod[/eluser]
[quote author="inparo" date="1213741699"]Yes. However, if it's sensitive data you might have to do both. If you're storing it in the session anyways you could probably find a post free workaround as well.[/quote]

I always use encrypt helper pass vars between pages by post,and the date is sensitive .




Theme © iAndrew 2016 - Forum software by © MyBB