* Add a <?php tag instead of a <?. Bug noted by Isam Ishaq <isam@planet.edu>
* Add support for regexp and like operators in accounting report generator
* Limit the split() to 2 elements in lib/defaults.php3
+* Create a AcctUniqueId before adding a row in radacct in log_badlogins.
Ver 1.62:
* Remove one sql query from user_admin which was not needed.
* Instead of a query like "LIKE 'YYYY-MM-DD%'" use "AcctStopTime >= 'YYYY-MM-DD 00:00:00 AND AcctStopTime
# all: no. Go to the end of the file. Don't read it all.
use Date::Manip qw(ParseDate UnixDate);
+use Digest::MD5;
$|=1;
$file=shift||'none';
unlink "$tmpfile.$server" if ($delete{$server});
open TMP, ">>$tmpfile.$server"
or die "Could not open temporary file\n";
- print TMP "INSERT INTO $sql_accounting_table (UserName,NASIPAddress,NASPortId,AcctStartTime,AcctStopTime,AcctSessionTime,AcctInputOctets,AcctOutputOctets,CallingStationId,AcctTerminateCause) VALUES ('$user','$addr','$port','$time','$time','0','0','0','$caller','$cause');";
+ $ctx = Digest::MD5->new;
+ $ctx->add($user);
+ $ctx->add($addr);
+ $ctx->add($port);
+ $ctx->add($time);
+ $ctx->add('badlogin');
+ $uniqueid = $ctx->hexdigest;
+ print TMP "INSERT INTO $sql_accounting_table (UserName,AcctUniqueId,NASIPAddress,NASPortId,AcctStartTime,AcctStopTime,AcctSessionTime,AcctInputOctets,AcctOutputOctets,CallingStationId,AcctTerminateCause) VALUES ('$user','$uniqueid','$addr','$port','$time','$time','0','0','0','$caller','$cause');";
close TMP;
`$mysql -h$server $opt -u$sql_username $pass $sql_database <$tmpfile.$server`;
$exit = $? >> 8;