jaymc Posted October 30, 2007 Share Posted October 30, 2007 I have a script that processes every 3 seconds via AJAX from a users browser This script writes new information to a cookie/session Can anyone see this being a problem Also, which is more effecient, a cookie or a session With a session that is going to require server disk access in regards to re-writing the session data and storing it on the server Cookie would be locally on the users machine Feedback would be great Quote Link to comment https://forums.phpfreaks.com/topic/75338-update-cookiesession/ Share on other sites More sharing options...
aschk Posted October 30, 2007 Share Posted October 30, 2007 Don't use cookies, there is no guarantee that the user has not modified them, let alone allowed them to be utilised. I imagine they're just as efficient as each other. As for disk access; it would be at both ends. SESSION on the server and cookies on the local machine, however the overhead from writing a SESSION would be negligble to be honest unless you're planning on writing MBs worth of information. Alternatively you could utilised a database to store the information instead of a session, but relate it to session_id and to the lookup. Either way it's disk access, although there is a good chance that your database system will have cached the query in memory for use in subsequent requests. Quote Link to comment https://forums.phpfreaks.com/topic/75338-update-cookiesession/#findComment-381011 Share on other sites More sharing options...
jaymc Posted October 30, 2007 Author Share Posted October 30, 2007 the session will only contain an ID Even if there where 150 SESSIONS being modified globally on my server it would still be cool? Quote Link to comment https://forums.phpfreaks.com/topic/75338-update-cookiesession/#findComment-381036 Share on other sites More sharing options...
jaymc Posted November 1, 2007 Author Share Posted November 1, 2007 I have went with using setcookie Again, can anyone smell any problems that may arise updating the cookie every 4 seconds ? Quote Link to comment https://forums.phpfreaks.com/topic/75338-update-cookiesession/#findComment-382641 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.