"Jerry Leonard" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am relatively new to php and mysql and would appreciate any help you can > provide. Here is the task: > > I need to have a point system added to my site. What I would like is when a > user logs in they will get 1000 points. But they only get it once per day.
Seems simple enough; if they have to log in, you obviously already keep per-user records. Add a field for accumulated points and a timestamp. Each time a person logs on, check the timestamp; if the last log-on was not today, increment their points and update the timestamp. Note: be careful about how you define 'not today'. Does that mean roll-over at midnight? But then midnight where? I live on the East coast, my server is in California, and who knows where my users are. Does it mean not within the last 24 hours? Then a user who logs on in the afternoon and again the next morning will only be credited once. More to the point, someone who logs on every day at 'about five o'clock' will on average get chopped half the time, and might get quite peeved about it. I might look at something like 'not within the last fifteen hours' and accept the slop just to keep it simple. What about nerds that never log off? Maybe it should be checked for each page served, rather than just at login. There are quite a few ways of phrasing it, each with tradeoffs. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php