LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-31-2010, 03:05 AM   #1
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
How do cookies work?


I understand that a website can set a cookie which means a little text file with a no. in it will be created on the client side, and then the no. will get sent to the server with every visit. But how is this used to customize a page? Does this mean that a MySQL database *has* to be created, which can be used to match up that no. with a particular login name, for instance? How exactly is this pulled off?


Thanks.
 
Old 03-31-2010, 03:40 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by resetreset View Post
I understand that a website can set a cookie which means a little text file with a no. in it will be created on the client side, and then the no. will get sent to the server with every visit. But how is this used to customize a page? Does this mean that a MySQL database *has* to be created, which can be used to match up that no. with a particular login name, for instance? How exactly is this pulled off?


Thanks.
Number ? If yes, why only number ? Is it documented that only number can be present in a cookie ?
 
Old 03-31-2010, 04:15 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
eg. have a cookie and tell me which number you would like to talk about:

zune cookie
Code:
ANON
A=DBBF8E95F2AFF0C32ADFA832FFFFFFFF&E=975&W=1
zune.net/
0
332911488
30101147
1166061920
30060855
*
NAP
V=1.9&E=91b&C=7On8wg9LTZqxP19YI_8dpbtQ7cjJ7hb2LW__mA0IOiN4xf-Bpubp9g&W=1
zune.net/
0
2190005120
30081030
1166381920
30060855
*
 
Old 03-31-2010, 05:17 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
A cookie can contain any information, it is just a mechanism of transferring data between the browser and the server. Each cookie has a life.Some may just live for the duration of that session, close the page and the cookie will be deleted. Others may last longer so that the next time that you visit the page the cookie is sent.

A cookie that lasts the duration of your visit is often used to identify you with the server. In this example an ID is sent to the server and this can be used to get session information (In PHP terms the session data is managed automatically so you don't need to worry about what is actually sent, and the session data is stored on the server, this is useful because it adds an element of security and reduces the amount of data being sent)

A persistent cookie, one that lasts between sessions, can record details of the users preferences, what page they were viewing last and so on.

The actual data that is in a cookie is only restricted by your imagination; what I suspect you are getting confused with is the cookies used for session management.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cookies phantom_cyph Linux - General 2 06-04-2007 04:40 PM
LQ Cookies don't seem to take Simon Bridge LQ Suggestions & Feedback 3 05-03-2005 03:35 AM
Where do cookies etc go? Bill Johns Linux - Security 3 04-11-2005 03:35 AM
Not getting cookies Fingel LQ Suggestions & Feedback 2 02-13-2003 07:45 AM
cookies sandy General 4 09-06-2002 01:00 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration