Skip to content
Advertisement

Check if user is inactive (last time he logged in) node.js mysql database

I have a little question. I would like to check when a user was logged in the last time. If the account is inactive it will be deleted from the database. I have no clue how to implement this. or how to check the time the user has logged in the last time. Can someone help me, please… I would be very happy if someone could help me 😉

Advertisement

Answer

From your question It is not clear what exactly you want but whatever I understand you can do below things

Last Login time :

  1. add a datetime field in database table which will hold time whenever user login.
  2. On login whenever user login just set current timestamp in the lastlogin table field
Advertisement