How to set cookies first and then store that in a database?
Moderator: General Moderators
-
indian98476
- Forum Commoner
- Posts: 78
- Joined: Tue Dec 15, 2009 3:24 am
How to set cookies first and then store that in a database?
i want to set cookies for users logging in so that i can give them back personalised webpages.,...i heard we must create the cookies and then store them in a database....can anyone code me into it?
-
indian98476
- Forum Commoner
- Posts: 78
- Joined: Tue Dec 15, 2009 3:24 am
Re: How to set cookies first and then store that in a database?
so here is my doubt now..
i got say 3 users a,b and c...when anyone logs in for the first time he should get a msg lets say Welcome to our site...
if the same user logs in again he should get a msg lets say welcome back
if a different user logs in the same browser he should get a msg lets say Welcome to our site
if the user who logged in first again logs in after this he should get welcome back
so if the first user's value is stored in d browser what bout the value of the next user?
i think u r getting my doubt...if not feel free to ask...
i got say 3 users a,b and c...when anyone logs in for the first time he should get a msg lets say Welcome to our site...
if the same user logs in again he should get a msg lets say welcome back
user's name
if a different user logs in the same browser he should get a msg lets say Welcome to our site
if the user who logged in first again logs in after this he should get welcome back
user's name
so if the first user's value is stored in d browser what bout the value of the next user?
i think u r getting my doubt...if not feel free to ask...
Re: How to set cookies first and then store that in a database?
But that's not something I'd do with cookies. Instead, simply store on your server (in a database, for example) which users have already logged in before.
So if someone logs in, you get the 'has_logged_in_before' value for the given username from your database, and display the appropriate welcome message. No need for cookies at all. Works also if someone clears his browser or logs in from another computer.
So if someone logs in, you get the 'has_logged_in_before' value for the given username from your database, and display the appropriate welcome message. No need for cookies at all. Works also if someone clears his browser or logs in from another computer.
-
indian98476
- Forum Commoner
- Posts: 78
- Joined: Tue Dec 15, 2009 3:24 am
Re: How to set cookies first and then store that in a database?
thanx appollo...i thought cookies were the ones that helped the user give suggestions on the textfield if he has come before for his username...but i learned that it is the work of browser...but how exactly does it do it?
Re: How to set cookies first and then store that in a database?
It simply remembers the strings that the user has filled in before in fields called "name", "email", etc.
A bit like caching.
A bit like caching.