Jump to content

jimfog

Recommended Posts

here is the cookie I used:

setcookie('cookiename', $enc_username .'/'. $token, time() + 60 * 60 * 24 * 7);

The $token is a random number(the one that gets in the Db) and $enc_username is the hashing of the username with sha1.I have placed also a separator character-a backslash to assist me in the separation of the username from the token. The problem, I do not see this backslash anywhere in the cookie-it does not get passed in the cookie,I am able to see the cookie through Fiddler-its value I mean and the backslash is missing. How am I going to separate the hashed username from the token-in the cookie they appear as one long big number.

Link to comment
Share on other sites

How am I going to url encode the backslash? Never heard that before. I think URL-encoding took place automatically-I am not sure.I saw in a tutorial that the forward slash is converted into %2F. From where can I make adjustments regarding URL encoding in scripts? And another thing, URL encoding seems to related with URLs, what values in cookies has to do with it? Just noticed the following,the forward slash DOES appear if I print_r the cookie in the browser-it does not appearwhen I see the cookie through Chrome settings about cookie data.

Edited by jimfog
Link to comment
Share on other sites

PHP has several encoding functions, include urlencode and rawurlencode. I don't know if PHP will automatically encode cookie data. Most data sent by a browser is URL-encoded, including POST and GET data (and presumably cookie data as well). If the value appears in your script then that's fine, I don't know why Chrome doesn't want to display it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...