/    Sign up×
Community /Pin to ProfileBookmark

Where store session

Hello,
Im trying create something like to google accounts where can i be logged into my account on few devices.
Now when i login into site from other device im in te same time has been logout me from first device.
Do you know where Can I store session or how to write app to hadle more device with logged users?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@rootNov 24.2017 — Database flag... each device has to have its own identity, therefore if you have a login, that login request can check first to see if the account is currently logged in to somewhere, if so the user can be alerted and decide if they want to logout the device remotely or keep that login as they may be using their other device at the same time. Give the user the option.

Other components to this would be login time and last activity, that way if theres been no activity in a set period of time, you can assume the account needs logging out of that device from inactivity.

There is a graceful way of doing this that allows the user to be in control rather than enforcing something on a person, if this is for a top secret military research base then yeah, go for it, go for the log out method...
Copy linkTweet thisAlerts:
@itengineerDec 10.2017 — You should be able do this with default php and web server settings (session saved on hard drive). Probably you use a framework which causes logout when the same user log in two times from different devices.
Copy linkTweet thisAlerts:
@rootDec 10.2017 — Sessions are not saved themselves, they are generated as part of the web page and they are checked by the server and expired at a set time or refreshed as per your wishes.

You pass session data through the use of the session_start() call and then find out if you have a session already running. If you do, this ID can be checked in a database to a user for reference to that users activity on the site.

Sessions can be used to store data about a visitor and where they went on your site by a session id and still serve up content that they may be interested in.
×

Success!

Help @dervill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...