Step #1: Add the columns to the appropriate table with ALTER TABLE commands. Add two columns last_access and logged_out, both of type TIMESTAMP (you can call them whatever you want, really, as long as you know what they are and mean.) Do this with phpMyAdmin, or whatever program you use to interact with the database.
Step #2: Add UPDATE query to login script which INSERTs the current timestamp into the last_access column once a user has validated. This goes with the stuff you do after the username password check. Don't forget to use a WHERE clause to indicate which user's data to update. Otherwise, it will affect all the users.
Step #3: Add UPDATE query to lougout script which INSERTs the current timestamp into the logged_out column when a user logs out explicitly. Again, be sure to add the WHERE clause, or you'll log everybody out.
Step #4: Use the SELECT query I posted earlier (or something like it) to find out who has accessed the database recently, and print out that list in whatever manner, and wherever you choose. If you are so inclined, you could use an ORDER BY clause to list them alphabetically.