I am making a login system. I made active_session table in database like this:
| id | user_id |session_key|others...|
| 12 | 6548 |kdjgs939493|.........|
I create a cookies with limited life time (like 1 hour or day etc). When I logout manually it destroys cookies and remove session record from database as well. The problem is that if someone login and doesn't logout, the cookies will expire after it time expires but how can i remove such sessions from database. because if these records are not deleted then there will be lot of useless sessions records in database