diff options
author | Yorhel <git@yorhel.nl> | 2009-01-10 11:48:12 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-01-10 11:50:59 +0100 |
commit | f213a6d848534146d8b6105f73ae52ebe8271ca1 (patch) | |
tree | 14a80cde3b3b2ae80115a6703848483869b10d46 /lib/VNDB/DB/Users.pm | |
parent | 614d693c4995a0de58379ce8c0780454b5f6db61 (diff) |
Limit account creation to one account a day per IP
This would at least annoy the people who'll try to manipulate
the rankings, and will make finding duplicate users a bit easier.
(Not that it's really a problem at the moment)
Diffstat (limited to 'lib/VNDB/DB/Users.pm')
-rw-r--r-- | lib/VNDB/DB/Users.pm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Users.pm b/lib/VNDB/DB/Users.pm index 188fb4d8..3a327197 100644 --- a/lib/VNDB/DB/Users.pm +++ b/lib/VNDB/DB/Users.pm @@ -8,7 +8,7 @@ use Exporter 'import'; our @EXPORT = qw|dbUserGet dbUserEdit dbUserAdd dbUserDel|; -# %options->{ username passwd mail order uid results page what } +# %options->{ username passwd mail order uid ip registered results page what } # what: stats sub dbUserGet { my $s = shift; @@ -35,6 +35,10 @@ sub dbUserGet { 'id = ?' => $o{uid} ) : (), !$o{uid} && !$o{username} ? ( 'id > 0' => 1 ) : (), + $o{ip} ? ( + 'ip = ?' => $o{ip} ) : (), + $o{registered} ? ( + 'registered > ?' => $o{registered} ) : (), ); my @select = ( @@ -77,10 +81,11 @@ sub dbUserEdit { } -# username, md5(pass), mail +# username, md5(pass), mail, [ip] sub dbUserAdd { my($s, @o) = @_; - $s->dbExec(q|INSERT INTO users (username, passwd, mail, registered) VALUES(?, decode(?, 'hex'), ?, ?)|, @o, time); + $s->dbExec(q|INSERT INTO users (username, passwd, mail, ip, registered) VALUES(?, decode(?, 'hex'), ?, ?, ?)|, + @o[0..2], $o[3]||$s->reqIP, time); } |