*

Recent

Author Topic: Plays Today: stuck on 0  (Read 7892 times)

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Plays Today: stuck on 0
« on: October 24, 2014, 02:48:24 AM »
I've got this running under XAMPP and the Plays Today: always stay at "0" ?

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Plays Today: stuck on 0
« Reply #1 on: October 24, 2014, 10:57:06 AM »
I've got this running under XAMPP and the Plays Today: always stay at "0" ?

Im wondering if the time zone isnt set. We are working on a new installer so the current one doesnt set the time zone right now. Try going inti the admi panel and set the time zone and see if that does it

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Re: Plays Today: stuck on 0
« Reply #2 on: October 24, 2014, 11:33:27 PM »
Set the time zone - Still doesn't count anything? :(

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Plays Today: stuck on 0
« Reply #3 on: October 24, 2014, 11:59:02 PM »
Set the time zone - Still doesn't count anything? :(

Hmm that is oddd... this is a fresh install correct? not updated from a previous install? If its updated im wondering if we missed something with the update script..

am-fs

  • Owner
  • Developer
  • Full Member
  • ******
  • Posts: 228
  • Force: +1/-0
    • Great Flash Games
Re: Plays Today: stuck on 0
« Reply #4 on: October 25, 2014, 12:32:52 AM »
This is the line that updates Total plays and Plays today
Code: [Select]
$db->query('UPDATE fas_gamestats SET total_played = total_played + 1,played_today = played_today + 1'); // adds a play to the total plays and played today stats

It might have to do 2 query's for XAMPP, not sure as i test my code on live servers
Code: [Select]
$db->query('UPDATE fas_gamestats SET total_played = total_played + 1');
$db->query('UPDATE fas_gamestats SET played_today = played_today + 1');

The time zone is for the reset of Plays Today only, I can verify that the top line works.

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Plays Today: stuck on 0
« Reply #5 on: October 25, 2014, 12:38:43 AM »
This is the line that updates Total plays and Plays today
Code: [Select]
$db->query('UPDATE fas_gamestats SET total_played = total_played + 1,played_today = played_today + 1'); // adds a play to the total plays and played today stats

It might have to do 2 query's for XAMPP, not sure as i test my code on live servers
Code: [Select]
$db->query('UPDATE fas_gamestats SET total_played = total_played + 1');
$db->query('UPDATE fas_gamestats SET played_today = played_today + 1');


The time zone is for the reset of Plays Today only, I can verify that the top line works.

I was just thinking that if it wasnt set that it could have been reseting the count every time the page reloads undoing any adding to it

am-fs

  • Owner
  • Developer
  • Full Member
  • ******
  • Posts: 228
  • Force: +1/-0
    • Great Flash Games
Re: Plays Today: stuck on 0
« Reply #6 on: October 25, 2014, 12:42:06 AM »
That is very possible too.

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Re: Plays Today: stuck on 0
« Reply #7 on: October 25, 2014, 02:29:11 AM »
I was just thinking that if it wasn't set that it could have been resetting the count every time the page reloads undoing any adding to it

I split the two queries to test the strings also.

But You're right on the reset, The reset happens on all refreshes of the play page.

I actually use something different with UNIX-Time that does Today(Last 24hrs), Weekly(Last seven days) and could do monthly and yearly too. The only drawback is that it only counts each game-played once per 24hrs.

So the margin of error would be what! 3% chance that more than one person plays the same game on the same day?

I can live with that...  :P
« Last Edit: October 25, 2014, 02:31:33 AM by Frank »

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Plays Today: stuck on 0
« Reply #8 on: October 25, 2014, 02:34:40 AM »
I was just thinking that if it wasn't set that it could have been resetting the count every time the page reloads undoing any adding to it

I split the two queries to test the strings also.

But You're right on the reset, The reset happens on all refreshes of the play page.

I actually use something different with UNIX-Time that does Today(Last 24hrs), Weekly(Last seven days) and could do monthly and yearly too. The only drawback is that it only counts each game-played once per 24hrs.

So the margin of error would be what! 3% chance that more than one person plays the same game on the same day?

I can live with that...  :P

So it only resets after viewing the play page? Or does it reset on every page view? That definitely helps narrow down the problem.

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Re: Plays Today: stuck on 0
« Reply #9 on: October 25, 2014, 03:18:00 AM »
Well, it shows nothing on the home page stats before playing a game and nothing after playing any of them?

So I couldn't tell you if it resets on every page - Depends where you have the hook for including "reset.php" - And if the hook is in play.php or in the 'headers' then it's going to reset on every play?

am-fs

  • Owner
  • Developer
  • Full Member
  • ******
  • Posts: 228
  • Force: +1/-0
    • Great Flash Games
Re: Plays Today: stuck on 0
« Reply #10 on: October 25, 2014, 11:10:00 AM »
that would be in the index.php

comment out this line => include('includes/reset.php');

see what happens

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Re: Plays Today: stuck on 0
« Reply #11 on: October 25, 2014, 04:32:28 PM »
I tried that earlier and the both the total-plays and the played-today both increment, so it's obvious that the reset script is causing the problem!

I also changed the date format and got the same result. :(

Edit:

I think I've fixed it - Will let you know tomorrow when it resets?
« Last Edit: October 25, 2014, 06:04:16 PM by Frank »

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Re: Plays Today: stuck on 0
« Reply #12 on: October 29, 2014, 04:28:28 PM »
Well, you're forcing the time-zone as America/Chicago and that doesn't help either. And though I changed the zone and the time format - It doesn't reset but continues to count.

Incidentally, from what I have come across - People use Unix-time for this type of thing?