I\'m following solution #1 of this answer. After a while, there will be some redundant rows in the table. Suppose this table:
+------+------
Add another column with a timestamp. Then run a regular cron job to delete any rows with a timestamp older than a certain threshold (say, 1 day for instance).
You can either put in a timestamp and update it every time you see that user, which means they get "logged out" x amount of time after they last used the site (but that means more database transfer); or you can just put in a timestamp when you create the session the first time and never touch it again, which will "log them out" x amount of time after they last logged in (less convenient for the user perhaps, but it means less database transfer).