otuatail Posted December 15, 2009 Share Posted December 15, 2009 Hi. I am a bit confused over my logging system of a website. I have used it for years without a problem. I use a session variable to store the current page being accessed. This allows me to use a database to log a history. $page = "Arts"; . . $_SESSION["current_page"] = $page; I can use this to populate the database. If the session variable is blank then this obviously is the first attempt to access the website and is identified as a hit count. This works but some ip address’s don’t work. Tue 15-Dec-2009 08:59:58 69.58. 178.28 RL-Home Hit Tue 15-Dec-2009 09:00:03 69.58. 178.28 About Hit Tue 15-Dec-2009 09:00:07 69.58. 178.28 Contacts Hit Tue 15-Dec-2009 09:00:10 69.58. 178.28 HIV Hit This is a brief log. As you see this agent is going through my web pages but the session variable is never set, making each access appear as a first time. I can have a hit count of 30 when it is the same agent accessing it. The full information retrieved for this is Tue 15-Dec-2009 08:59:58 69.58. 178.28 RL-Home Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3; ips-agent) Gecko/20090824 Fedora/1.0.7-1.1.fc4 Firefox/3.5.3 Quote Link to comment Share on other sites More sharing options...
cags Posted December 15, 2009 Share Posted December 15, 2009 I would imagine the client has Cookies disabled, meaning that when you establish a session, they are not remaining 'connected' because they have not accessed the SessID cookie. Quote Link to comment Share on other sites More sharing options...
otuatail Posted December 15, 2009 Author Share Posted December 15, 2009 are cookies needed? A session variable is on the server and is fixed for 20-30 mins or if a nother page is accessed. Don't think a user needs a cookie. Quote Link to comment Share on other sites More sharing options...
cags Posted December 15, 2009 Share Posted December 15, 2009 I suggest you do a bit of research of how a Session works, it's a common misconception. Sessions (by default) require cookies. Yes, as you say the information is stored on the server, but how do you think the server associates different sessions with individual users? The way this works by default is a Session ID is sent to the client and stored in a Cookie, then each time a client makes a request this Session ID is sent to the server. The server will then use this ID to find that individual users Session Cookie (which is stored on the server). You can track Session ID's in other manners, such as persisting it via the URL (as I'm sure you will have seen on sites before), but that doesn't change the fact that by default, cookies are required to run Sessions. Quote Link to comment Share on other sites More sharing options...
otuatail Posted December 15, 2009 Author Share Posted December 15, 2009 Ok thanks for that. Is there a way of testing for this please. Desmond. Quote Link to comment 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.