I don't have the code but i can tell you what's the logic behind it i think there is a table in your database in which you are storing your user login or other information, in that table create a new column and update that column on page load with the users name or id on that time. and when you want to display the recent visitors display the 10 results and select them as no one gets repeated.
Of course that depends on how far back you want to go, you may want to create a link table to link users to users in the form of visits. So this table would have 4 columns:
uservisitspk, primary key
userpk, refers to the user
visiteduserpk, refers to the visited user