Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
02-17-2012, 08:53 PM #1
- Join Date
- Mar 2011
- Thanked 0 Times in 0 Posts
Hopefully this is a pretty basic questions, but my level of php knowledge is even more basic at this point...
On my website, a user enters at Page 1, completes a short game on Page 2, and is fare-welled on Page 3. Also on Page 3, a unique text file is created with data and stored on the server in a folder called "data".
Thus, the number of text files in the folder "data" is represents a count of how many users have made it to Page 3.
Any help would be very appreciated.
02-18-2012, 03:56 PM #2
- Join Date
- Jan 2011
- Thanked 644 Times in 643 Posts
Off the top of my head I don't know how to count files in a folder. I suppose there is a way and I'm sure someone will enlighten us, but in the mean time....
Things would be a lot simpler if you used a database to keep your information, the number of files could increase into the thousands. My suggestion is to have a file that contains a number. That number is the number of files in your folder. When you reach page three, open that file and set a variable to that number and add 1 to it. Then when you store your file on the user over write the number file. It will always have the latest and truest count of people that have made it to page three and can be accessed from page one.
02-18-2012, 04:24 PM #3
$directory = "../datafiles/";
if (glob($directory . "*.txt") != false)
$filecount = count(glob($directory . "*.txt"));