471,579 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,579 software developers and data experts.

Storing data for future visits

I have this problem:
I have a database with information about games, and users are able to vote
for them. Everytime a user votes for a game I store the unique game name
into a session variable (an array). So if they are in a page were they
already voted, they won't have the option to do so.
The idea is that the session cookie lasts "forever", I don't want them
voting for the same game everytime they get to the site. This isn't soo
strict, I don't care if some few users don't accept cookies and eventually
vote 2 times for the same game.
So what I did is to have a session cookie with a very large expire time and
I noted that the session variable data is stored in my server
in /temp/sess_blabla
my questions are:

1. how much does this data last?, can I make it last forever with
session_cache_expire()?
I still don't like this solution, data would be lost if I change the server,
I would prefer that the client store this info with his session ID so:

2. I've searched and read that you can store data in a cookie, but coudln't
find the way to do it. Can I store this variable in the users session
cookie?, how?

3. Any better idea?, maybe storing this info in the database?

Thank you. I hope I was clear.

Francisco
Jul 17 '05 #1
2 1672
Francisco wrote:
I have this problem:
I have a database with information about games, and users are able to vote
for them. Everytime a user votes for a game I store the unique game name
into a session variable (an array). So if they are in a page were they
already voted, they won't have the option to do so.
The idea is that the session cookie lasts "forever", I don't want them
voting for the same game everytime they get to the site. This isn't soo
strict, I don't care if some few users don't accept cookies and eventually
vote 2 times for the same game.
So what I did is to have a session cookie with a very large expire time and
I noted that the session variable data is stored in my server
in /temp/sess_blabla
my questions are:

1. how much does this data last?, can I make it last forever with
session_cache_expire()?
I still don't like this solution, data would be lost if I change the server,
I would prefer that the client store this info with his session ID so:

2. I've searched and read that you can store data in a cookie, but coudln't
find the way to do it. Can I store this variable in the users session
cookie?, how?

3. Any better idea?, maybe storing this info in the database?

Thank you. I hope I was clear.


It seems to me that, if you really want to store information about a
user and their choices 'forever', the right place to do that is in
your own database. Storing anything on the client side that you might
need across sessions is a fragile strategy. The only things you
should store there are things that add to that user's convenience, but
that you yourself don't need.

Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
Jul 17 '05 #2
Margaret MacDonald wrote:
It seems to me that, if you really want to store information about a
user and their choices 'forever', the right place to do that is in
your own database. Storing anything on the client side that you might
need across sessions is a fragile strategy. The only things you
should store there are things that add to that user's convenience, but
that you yourself don't need.

Margaret


Well, is not that I want to store information forever, just to make sure
that it last while the session lasts. And for a big number of users this
will apply with no problems using cookies, that's why I thought in storing
the info in the cookie, if it's possible. While the session is active, the
info will be there. There is no user login of any kind, and I don't want
it, I want a very simple and easy to use site.

Francisco
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Wynand Winterbach | last post: by
3 posts views Thread by prasanthag | last post: by
8 posts views Thread by johnds | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by lumer26 | last post: by
1 post views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.