You can also so this without storing the info in session and application state if you're willing to take a performance hit.
In an application I built a while ago, I had the same requirement. We ended up updating the LastHit table on *every* request made to the server, through a simple include file. This table holds the date and time of the last hit and the ID of the user in the User table.
A user's session would time out after 20 minutes (you can do that with sessions, or with a cookie that is valid for 20 minutes). As soon as the same user tried to log in within these 20 minutes (by querying the LastHit table), we would not allow him in.
Personally, I didn't feel comfortable with this requirement. Our client insisted, but if I had to do it all over again, I would insist more on *not*doing it. There really isn't a point anyway. If you consider the stateless nature of the Web, the client is not logged in anyway, although you fake around a bit. The idea is that it really doesn't matter what "terminal" the user uses to access your site. Who cares anyway? As long as you know who you're dealing with.
Is there any particular reason for this requirement?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Forfeit by
Chevelle (Track 8 from the album:
Wonder What's Next)
What's This?