#!/usr/bin/perl -w

use DBI;
use LWP::Simple;

my $dbh = DBI->connect( 'dbi:mysql:dbname=lamp;host=localhost',
			'lamp', '_password_' ) or die "$DBI::errstr";

my $meq = $dbh->prepare( "select channel_number, username from channels where username != ''" );
$meq->execute;

open LOG, ">>/var/log/lamp-usage.log";

print LOG time, " ";

while ( ($chan, $username) = $meq->fetchrow_array ) {
    $username =~ s/\@.*//;
    print LOG "$chan=$username ";
}

print LOG "\n";

close LOG;



