Jump to content

Storing Data in sessions or cookies?


Monkuar

Recommended Posts

For my RPG game.  I have a chatbox that is a notification box and a actual live chat (using only short polling) for now.

 

 

I was wondering what's the best way to store client side information to display to the user?  Like if a user kills a monster It will put "Gained 200 EXP".  /etc/etc, Would using cookies for this be a good idea or...?  would need to save that data for atleast a day, or 15+hours.  I do not want to use mysql for this, there has to be a way storing it clientside?

 

 

Link to comment
https://forums.phpfreaks.com/topic/267139-storing-data-in-sessions-or-cookies/
Share on other sites

The problem with storing it in a cookie is that it's going to be sent to the server with every request - waste of bandwidth.

 

This is what databases are designed to do, so I'm not sure why you're against going that way.

 

I just figured maybe the logs will take a performance hit.. I guess it just depends how bad I optimize them then eh?

 

Like, if I am farming some mobs, and each time I kill 1 or take a hit, I want it to show "Took damage of "XXX", "You killed merman/etc gained 200XP".  Maybe I am thinking little notifications to the user are fine for that instead of actually storing it? Maybe I am getting it a little mixed up, I apologize. 

 

I guess making a logs table will be a good idea, I can always just prune old ones after xx amount of time, or let the user delete his logs (that ARE NOT ESSENTIAL) if he/she wants.  I think I might have been thinking a little bit to much and over-thought this process, I need to relax and let go.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.