in reply to Identifying fraudulent users, by comparing values in database. with a hash..?

Thnaks to all that replied, there has been a change of plans. instead of using hashes, and trying to come up with a list of all the users with their fraud_factor, I'll just have the user specify an id, and compare it's values to all the rest of the userids, in the database, one row at a time. multiple tables will be queried. this is bound to slim the process down. (on a side note, I came to find out while trying to merge a months worth of apache logs that the intel limit for a process in ram is 2.8 gigs, with an increase expected, with next release to 3.6 gigs) I'm not short on criteria to check for. It is a comparison shopping/auction website, and one of the good signs that there is something fishy is that the sellers, have the same products in the same price range. we get email, and credit card, so that has alredy been taken care of on the registration portion of it. so if you registered you must have given a correct name/lastname/credit card info. so forth and so on. this is what I'll try to do:
#!/usr/bin/perl use warnings; #use strict; use DBI; my ( ); #put my vaiables ^ there $testuserid=$ARGV[0]; $test_sql="select firstname, lastname, password, username, dob, zipco +de, age, remotehost, ut, secret_question, secret_answer from users wh +ere userid=$testuserid;"; $db_test = DBI->connect("DBI:mysql:database=my_userdb;host=db_host","m +aster","",{RaiseError=>0}); if ( !$db ) { $fraud{$testuserid}->{secret_question}=$d->{"secret_question" +}; print "Cannot contact aladdin, bypassing."; } $query_test = $db_test->prepare($test_sql); $query_test->execute(); while ($d = $query_test->fetchrow_hashref()) { # $testuserid=$d->{"testuserid"}; $test4firstname=$d->{"firstname"}; $test4lastname=$d->{"lastname"}; $test4password->{password}=$d->{"password"}; $test4username->{username}=$d->{"username"}; $test4dob=$d->{"dob"}; $test4zipcode=$d->{"zipcode"}; $test4age=$d->{"age"}; $test4remotehost=$d->{'remotehost'}; $test4ut=$d->{"ut"}; #cookie $test4secret_q=$d->{"secret_question"}; $test4secret_a=$d->{"secret_answer"}; $fraud_factor=0; # more queries, more variables #........................... #........................... } $db_test->disconnect(); $sql = "select userid, firstname, lastname, password, username, dob, z +ipcode, age, remotehost, ut, secret_question, secret_answer from user +s where status='ok' limit 5;"; $db = DBI->connect("DBI:mysql:database=my_userdb;host=mydbhost","maste +r","",{RaiseError=>0}); if ( !$db ) { print "Cannot contact aladdin, bypassing."; } $count=0; $query = $db->prepare($sql); $query->execute(); while ($c = $query->fetchrow_hashref) { $count++; $userid=$c->{"userid"}; $firstname=$c->{"firstname"}; $lastname=$c->{"lastname"}; $password=$c->{"password"}; $username=$c->{"username"}; $dob=$c->{"dob"}; $zipcode=$c->{"zipcode"}; $age=$c->{"age"}; $remotehost=$c->{'remotehost'}; $ut=$c->{"ut"}; $secret_q=$c->{"secret_question"}; $secret_a=$c->{"secret_answer"}; # more queries, more variables #........................... #........................... # do some creative tests, while incrementing # fraud_factor for combinations of matches } $db->disconnect(); print "$testuserid\t $fraud_factor";
We have about 300k registered users, so this, won't be too bad, I hope.
As always, your feedback is appreciated.
Regards:
~vili
  • Comment on Re: Identifying fraudulent users, by comparing values in database. with a hash..?
  • Download Code