Topic: Login popup help

Hope somebody can help
I have a php script which i have inserted into the popup so that the user can see there total usage in the logout popup, but the thing i am struggling with is that my username is just test
eg
$dbResult = mysql_query ( "SELECT CAST(SUM(`AcctInputOctets`) +

SUM(`AcctOutputOctets`) AS CHAR)" . "FROM radacct WHERE UserName =

'test'" );
so how can i retrieve the username as they login so they are viewing the correct data
my initial idea is maybe to retrieve the username from the last_insert_id record
????
any help and guidance would be great
Regards Tudor