dalawh Posted May 31, 2012 Share Posted May 31, 2012 I was looking at http://www.w3schools.com/js/js_cookies.asp and I was wondering if there was something more detailed on cookies. How do cookies look like? Are they just like a text in a document? If you look at the getCookie function, it only gets one line from the cookie, which I assume is because of the setCookie function only creates 1 line, but isn't a cookie normally larger or are cookies individually defined/created by the web designer and not the browser itself? What does "unescape(y)" do? Link to comment Share on other sites More sharing options...
niche Posted May 31, 2012 Share Posted May 31, 2012 Cookies are a array called $_COOKIE (all caps). One of the many ways they can be viewed is with a var_dump(). Link to comment Share on other sites More sharing options...
dalawh Posted May 31, 2012 Author Share Posted May 31, 2012 Cookies are a array called $_COOKIE (all caps). One of the many ways they can be viewed is with a var_dump().Isn't $_COOKIE php? Is there a better tutorial any where? Can you tell me a bit more on var_dump()? Link to comment Share on other sites More sharing options...
boen_robot Posted May 31, 2012 Share Posted May 31, 2012 Yeah... those are PHP stuff... it's where cookies make most sense anyway.All cookies for a domain look like a single string. Browsers store one cookie file per domain, and send the contents of this file on every HTTP request to that domain. In JavaScript, you have the whole file in "document.cookie", and the very page you linked to shows how to parse the contents in order to get a particular value.In PHP, you don't need to parse the file. It's automatically parsed into the $_COOKIE array in a fashion similar to what the W3Schools page shows. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 31, 2012 Share Posted May 31, 2012 If you want to know what the cookie actually is, it's typically just stored as a text file that contains the data (name and value) that you set. When the browser sends it to the server it sends the name and value that was stored on your computer for that website. Link to comment Share on other sites More sharing options...
dalawh Posted May 31, 2012 Author Share Posted May 31, 2012 Oh okay. Makes much more sense. Thanks for explaining this. Time to move on to PHP. Link to comment Share on other sites More sharing options...
niche Posted May 31, 2012 Share Posted May 31, 2012 Sorry about that. I clicked-in from the recent topics heading. It didn't even occur to me to check which forum I was in. Please excuse me. Link to comment Share on other sites More sharing options...
dalawh Posted June 2, 2012 Author Share Posted June 2, 2012 So does anyone know what "unescape(y)" does? Link to comment Share on other sites More sharing options...
Ingolme Posted June 2, 2012 Share Posted June 2, 2012 Here's the reference page for unescape(): http://w3schools.com/jsref/jsref_unescape.asp Cookie data is escaped. unescape converts escape sequences of the format "%HH" into characters. Link to comment Share on other sites More sharing options...
dalawh Posted June 2, 2012 Author Share Posted June 2, 2012 Here's the reference page for unescape(): http://w3schools.com...ef_unescape.asp Cookie data is escaped. unescape converts escape sequences of the format "%HH" into characters.So all values in a cookie are encoded? Only the values and not the variables? Link to comment Share on other sites More sharing options...
Ingolme Posted June 2, 2012 Share Posted June 2, 2012 The name is encoded and the value is encoded, to prevent characters like "=" or "&" from interfering with correct parsing of the cookie string. Link to comment Share on other sites More sharing options...
dalawh Posted June 2, 2012 Author Share Posted June 2, 2012 The name is encoded and the value is encoded, to prevent characters like "=" or "&" from interfering with correct parsing of the cookie string.Oh okay. Thanks for explaining this. Any way I can close this thread? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.