quote:
Originally posted by ipab
quote:
Originally posted by Regexp
Just compare today with the lastest reputation given. You can add a cookie, but you can also let it be daily
elaborate please
edit: btw its still querying the database isnt it
Of course, one query.
I'm not good at explaining, so I'll do some kind of pseudo-code.
code:
query "select * from mybb_reps where id={$id}"
while(array = mysql_fetch_assoc(query)) {
today_begin = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
today_end = today_begin + 86400;
if(array['lastrep'] >= today_begin && array['lastrep'] <= today_end) {
todayreps_total++;
todayreps_points += array['reppoint'];
}
}
# etc.
# echo
Please note: this code is probably bogus (aside from being pseudo and making up table stuff). I'm actually sculpting (
I'll take pictures later) and didn't have time to think about the timestamp comparison, so it might be wrong.
WDZ probably knows how to do it in a simple way.