xcandiottix Posted August 20, 2010 Share Posted August 20, 2010 session_save_path("/home/content/q/1/w/q1w2e3r4t5y6u7/html/tmp/"); session_start(); I have this at the head of my index page. I'd like to count how many files are in temp to find out how many users are online. After going to my index page, i checked how many users were online via the script I wrote and it said 1. I refreshed the page and it said 2. It went as high as 10 with each refresh and then I stopped because something isn't right. I checked my temp folder and there are 10 temp files. How can one page visitor start so many unique sessions? Is there a way to prevent this? I'm using the session start command with dual purpose. One, if a user loads the page. Secondly, to check if $_SESSION['active'] exists so I know this is a registered user. How can i limit the amount of sessions started by an unknown user and efficiently count how many files are in the temp directory? Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted August 20, 2010 Share Posted August 20, 2010 you can look into storing your sessions in a database rather then on the server. Its especially a good idea if the site your making is going to get so heavy traffic wise and user base wise that you will eventually need to cluster servers to run the site, and storing sessions on a single server in a clustered arrangement just wont work well. Quote Link to comment Share on other sites More sharing options...
xcandiottix Posted August 20, 2010 Author Share Posted August 20, 2010 Some reading I came across had counting session files performing at 19% faster then a database method. I don't know if this is correct information or not but it said in a multi-user situation that a file count would be preferred due to the speed factor. Have you come across anything about that? This article could have referred to an old version of php perhaps. As for my sever I am using a linux grid server provided by godaddy if that makes a difference. Thanks for the reply. 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.