I have a query, I want that if a user is already logged in to a web page and again he Relogins from same or different machine then his previous session should be killed and aut
If you attach a session id to a user id, then when you create a new session id, it will replace the current session id, and when you check for the valid session id, you will see that the old one is not longer found, so your application would tell them that they have been logged out.
If you want to keep track of the session id, then just have a valid flag that is unique between the userid and valid flag, so each user only has one valid session at a time.
If you see that they have a second session id then you can let them know that they were logged out of the first session due to logging into the new session.