user1950349
user1950349

Reputation: 5146

Session getting terminated after 30+ minutes of inactivity automatically?

I am working on a project where I need to have login system with multiple users where each user will login and save form entries in a file. I have maximum 10 internal users and this project is only for internal users.

Here is the idea -

Now this whole system works with multiple users where only one user is allowed to save entries in a file at a given time if multiple users are logged in.

Case 1:

  1. If "userA" logins successfully for the first time, then he can save the form entries in a file.
  2. "userA" logs out.

Case 2:

  1. Now "userB" logs in successfully. Then he should be able to save the form entries in the same file by overwriting it.
  2. "userB" logs out.

Case 3:

  1. Now "userA" logs in successfully again. And he is working on making changes in the form.
  2. And "userB" tries to log in suddenly from different browser. Then he should be able to see a prompt telling userA is logged in. Do you want to take over?. If he clicks ok button then he should login successfully. But if he click cancel button then he will not be able to login.
  3. Let's say if "userB" clicks ok button and he logs in now as well. At this moment both "userA" and "userB" are logged in. So as soon as "userB" logs in then if "userA" tries to click save button in the form trying to save entries in the file then it should popup telling your "Write access is revoked since userB is logged in now". So userA can still see the form but should not be able to save anything since his write access is revoked.

Case 4:

  1. If "userC" also logs in successfully. Now we have all three users logged in. At this time only "userC" should be able to make changes as write access will be revoked for "userA" and "userB".
  2. But if "userC" logs out then "userB" should be able to save form if he tries to save. Because "userB" access was revoked last so he will get his access back if "userC" logs out but "userA" access will be revoked still.

Problem Statement

Is there something in php server which can terminate my session after a particular period of time.

Upvotes: 0

Views: 493

Answers (1)

ash
ash

Reputation: 524

It depends on the server configuration or the relevant directives http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime in php.ini

Typically the default is 24 minutes (1440 seconds), but your webhost may have altered the default to something else.

UPDATE

as per OP new comments.

If session is stored in files give the permission 777 to storage directory in you server. If you are storing the session in database then we have to find out other alternate solution.

Upvotes: 1

Related Questions