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

Issue

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 😉

Solution

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

Answered By – Passionate Coder

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published