If you want to use a text file then instead of updating the database you could append the user on to the end of the text file with a time. Its a lot messier but possible.
Read the text file off
use : to seperate values
so your text file would have
user1:20.30
user2:20.32
read this off into two arrays
users[]
times[]
if your user is in users, say users[5]
then update times[5] and overwrite the text file
if the user isnt in the text file append $user.":".$time to it.
you could then use this to see who has been online in the last few minutes
Also you should do a check on old users and delete them so you dont have an enormous text file
Al