I want to develop a web application. In that I need to implement that the user can't open it in more than one instance in any system. I want to restrict it based on the user and machine. ie. a single user name should be used to login to the application only once at any given time and in a single system the application should not be opened more than one instance.

Can anybody suggest me how to achieve this.

Thanks in advance.

Recommended Answers

All 2 Replies

personally, I don't really see the point of this.
not to mention, you risk a lot of overhead. what you could do is to use cookies. when you login, you store your username and "logged in", or better yet, a timestamp, which you update while you're on the webpage. when you logout, you remove that cookie.

now, what were to happen if you just closed your browser and didn't log out the application? if you just put log in, and test for that, your user will not be able to log in anymore. actually, nobody on that system will, since in order to log in, you must be running (if only the login part of) the application.

so: compare the timestamp stored in there. if the difference between the timestamp and the current time is considerable, you may deduct the application is not running.

another way would be to store all that information online, but if you were to do that, you would have constant data updates for every user/system. not only will that get you a lot of overhead of data in your db, but the bandwith usage 'll rise considerably.

So, to be clear, you want any specific user to be able to only start one instance, no matter which machine they are running on? IE, 1 user, 1 instance == OK. 1 user, multiple systems != OK?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.