- &dbReplace("stats", (nick => $who, type => $_, counter => $v) );
- # does not work, atleast with old mysql!!! :(
-# &dbReplace("stats", (nick => $who, type => $_, -counter => "counter+1") );
+ &VERB("textcounters: $x matched for $who",2);
+ my $c = $chan || "PRIVATE";
+
+ # better to do "counter=counter+1".
+ # but that will avoid time check.
+ my ($v,$t) = &sqlSelect("stats", "counter,time", {
+ nick => $who,
+ type => $x,
+ channel => $c,
+ } );
+ $v++;
+
+ # don't allow ppl to cheat the stats :-)
+ if (defined $t && $time - $t > 60) {
+ &sqlReplace("stats", {
+ nick => $who,
+ type => $x,
+ channel => $c,
+ time => $time,
+ counter => $v,
+ } );