hanlonj Posted July 1, 2007 Share Posted July 1, 2007 Hi, I've just been reading the PHP manual and they say that SESSIONS are based on cookies. So does this mean that in order for a SESSION to work, that cookies must be turned on in a browser? Stoney Quote Link to comment https://forums.phpfreaks.com/topic/57991-solved-do-sessions-require-cookies-be-turned-on/ Share on other sites More sharing options...
GingerRobot Posted July 1, 2007 Share Posted July 1, 2007 Yep. Thats possibly the shortest answer ive given on these forums Quote Link to comment https://forums.phpfreaks.com/topic/57991-solved-do-sessions-require-cookies-be-turned-on/#findComment-287432 Share on other sites More sharing options...
trq Posted July 1, 2007 Share Posted July 1, 2007 No. However, without cookies enabled your session id will be passed around via the url. Quote Link to comment https://forums.phpfreaks.com/topic/57991-solved-do-sessions-require-cookies-be-turned-on/#findComment-287440 Share on other sites More sharing options...
sKunKbad Posted July 2, 2007 Share Posted July 2, 2007 if you use session.use_trans_sid=1 in your php.ini file you don't need cookies to be turned on. I do this in case somebody has cookies turned off. Quote Link to comment https://forums.phpfreaks.com/topic/57991-solved-do-sessions-require-cookies-be-turned-on/#findComment-287575 Share on other sites More sharing options...
corillo181 Posted July 2, 2007 Share Posted July 2, 2007 i have few question since this topic is mad ei dont want to make a new one.. cookies are store in the user pc? for which purpose would i use cookies? Quote Link to comment https://forums.phpfreaks.com/topic/57991-solved-do-sessions-require-cookies-be-turned-on/#findComment-287584 Share on other sites More sharing options...
sKunKbad Posted July 2, 2007 Share Posted July 2, 2007 In the case of a session, the cookie only holds an identification number, and when the user who has the cookie accesses the pages that are in the session, their browser identifies itself to the server as holding the session cookie. When the server then sends the page to the user, it uses data that was stored in the $_SESSION array. The beauty of using sessions is that an array value may be stored, and even if the back button is pressed on the browser, the array value is still the same. For this reason a shopping cart is usually set up with a session. The cart itself normally contains items, and when items are added or deleted from the cart, the $_SESSION array is updated. If a user then hits the back button, or browses the site and comes back, the shopping cart is still "alive" and holds the items that are still supposed to be there. I hope this makes sense. There are other reasons for using sessions, and perhaps others might add some knowledge here. Quote Link to comment https://forums.phpfreaks.com/topic/57991-solved-do-sessions-require-cookies-be-turned-on/#findComment-287615 Share on other sites More sharing options...
rempires Posted July 2, 2007 Share Posted July 2, 2007 A lot of places use cookies to identify if a person has voted in a poll. example after a person voted you put a cookie on there computer saying that they voted, this way instead of showing the voting option you show the results... You may also just want some data that you don't need to keep perminitly but just helps to make your site look better and instead of storing it in a database, you give them a cookie if they delete it doesn't matter, just like things such as user last visited this post at 12:oo pm, there was a new post at 3:00pm so put a little image saying new post next to the link, if there was no new post after 12:00pm no action. Quote Link to comment https://forums.phpfreaks.com/topic/57991-solved-do-sessions-require-cookies-be-turned-on/#findComment-287630 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.