registration and log in system. Preventing multiple log in at the same time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bonyyblaze
    New Member
    • Jul 2014
    • 1

    registration and log in system. Preventing multiple log in at the same time

    I am quite new to php and database. I have made some progress over the days as i try to implement something i have on my mind. I wish to create a register and log in system for my personal site.I have watched so many online videos to do that and i am faced with a problem What i wish to implement is when a registered user logs in,lets say at home and goes to work to log in with his office pc using the same user name and password, i wish to have that user logged out automatically from his pc at home as he tries to log in with his office pc. at this moment i am setting things on my localhost and hope to find a solutions before taking it online. Will i be able to achieve this with if i create sessions in the data base?. How do i go about it? Please help Thanks
    Your reply will be very much apprieciated

    I dont mind sharing what codes i have written as a beginner.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    the only thing I can imagine that could do that would be having a browser-based client (a web app) that connects to the server via sockets and not via HTTP.

    if you wanted to use HTTP, you could check the IP of the user and decline any request coming not from the latest IP. beware though that this may not work for computer on the same LAN and you might get problems if the user gets his dynamic IP reassigned.

    besides that, in a web environment you do not log in a specific client (browser) but identify yourself to a server (i.e. if a request provides the correct credentials (either a user-password combination or some specific token (e.g. a session cookie)) the request is treated as part of the session). where this request comes from is irrelevant to the server (although your application may care about such details).

    tl;dr HTTP-wise you cannot log out a user from a specific computer because HTTP does not have persistent connections (you have to log in for each request you make) that’s why it is a stateless protocol

    Comment

    Working...