tags:

views:

175

answers:

1

Hi everyone!

Does anybody knows how to implement something into a website written in PHP, similar to the Woot-badge and the Fanatic-badge on stack overflow? I want to reward my users if they visit my site everyday for 75 days, without days they don't visit it. My site uses sessions for log ins. And I use a MySQL database.

The users table now looks like this:

COLUMN NAME        TYPE
id                 integer
username           varchar
password           varchar
email              varchar
(7 columns with privacy settings) integer
lastvisit          integer
lastlogin          integer

Thanks in advance

+5  A: 

Psuedo-code:

switch last visit
   case yesterday
      increment counter by 1
      set last visit to today
      if counter == 75
          award badge
   case more then a day ago
      set counter to zero
      set last visit to today
David Dorward
Thanx! I'll make a new column called wootcounter or similar.
Time Machine