473,467 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Exclusive session

Hi all,
How to make a session "exclusive"? When one attempts to open a new
session either he's warned and asked to wait or any other openned
session is closed.
The need is to force only one user at the same time.
I'm currently using the database but also looking at a php only solution.
Thanks in advance.
--
Forje
Sep 24 '06 #1
9 2473
>How to make a session "exclusive"? When one attempts to open a new
>session either he's warned and asked to wait or any other openned
session is closed.
If a session is already open, PHP generally just uses that session
and does not try to open another one.
>The need is to force only one user at the same time.
Since there are plenty of ways to leave a session without informing
PHP of that, this is going to be a severe problem. You can time
out sessions but that can be very annoying to your users. Indefinite
lockouts are even worse.
>I'm currently using the database but also looking at a php only solution.
There really isn't a good solution, period, unless allowing a user
a maximum of zero sessions is acceptable.

Sep 24 '06 #2
Gordon Burditt a écrit :
>How to make a session "exclusive"? When one attempts to open a new
session either he's warned and asked to wait or any other openned
session is closed.

If a session is already open, PHP generally just uses that session
and does not try to open another one.
It is a particular application: a remote interface to administrate a
system. The idea is to prevent concurrent access to the system. Stop on
one side, start on an other...
>The need is to force only one user at the same time.

Since there are plenty of ways to leave a session without informing
PHP of that, this is going to be a severe problem. You can time
out sessions but that can be very annoying to your users. Indefinite
lockouts are even worse.
In this case, a direct close of any other openned session would not be a
problem.
>I'm currently using the database but also looking at a php only solution.

There really isn't a good solution, period, unless allowing a user
a maximum of zero sessions is acceptable.
PHP does not give a client the direct knowledge of the existence of
other connections. That's why I use the db for the moment.
Sep 24 '06 #3
>>How to make a session "exclusive"? When one attempts to open a new
>>session either he's warned and asked to wait or any other openned
session is closed.

If a session is already open, PHP generally just uses that session
and does not try to open another one.
It is a particular application: a remote interface to administrate a
system. The idea is to prevent concurrent access to the system. Stop on
one side, start on an other...
>>The need is to force only one user at the same time.

Since there are plenty of ways to leave a session without informing
PHP of that, this is going to be a severe problem. You can time
out sessions but that can be very annoying to your users. Indefinite
lockouts are even worse.
In this case, a direct close of any other openned session would not be a
problem.
Don't be too sure. You never have browser crashes, modems dropping
carrier, power outages, or net outages, none of which close an open
session? You never get distracted and have to navigate elsewhere?
>>I'm currently using the database but also looking at a php only solution.

There really isn't a good solution, period, unless allowing a user
a maximum of zero sessions is acceptable.
PHP does not give a client the direct knowledge of the existence of
other connections. That's why I use the db for the moment.
Poking around the session save files of other sessions is a
possibility, but direct use of a database is probably more efficient
and less likely to cause trouble with two near-simultaneous login
attempts from different places.

Sep 24 '06 #4
Gordon Burditt a écrit :
>>>How to make a session "exclusive"? When one attempts to open a new
session either he's warned and asked to wait or any other openned
session is closed.
If a session is already open, PHP generally just uses that session
and does not try to open another one.
It is a particular application: a remote interface to administrate a
system. The idea is to prevent concurrent access to the system. Stop on
one side, start on an other...
>>>The need is to force only one user at the same time.
Since there are plenty of ways to leave a session without informing
PHP of that, this is going to be a severe problem. You can time
out sessions but that can be very annoying to your users. Indefinite
lockouts are even worse.
In this case, a direct close of any other openned session would not be a
problem.

Don't be too sure. You never have browser crashes, modems dropping
carrier, power outages, or net outages, none of which close an open
session? You never get distracted and have to navigate elsewhere?
If a session is still open because another user leaved without closing,
a new connection would close it anyway or at least prompt the new user
for 'kill current admin session y/n?'
To do that, I need to check a flag in the database for any action in the
current session (to see if a new connection is active and close brutally
the current session if needed. I would like to avoid this check in db.
Sep 24 '06 #5
>To do that, I need to check a flag in the database for any action in the
>current session (to see if a new connection is active and close brutally
the current session if needed. I would like to avoid this check in db.
(1) You need to use something that all 'connections' can see and share.
Sessions don't fill this bill.

(2) Since you will (won't you? - I would!) be recording access to the
admin system, you'll be keeping database records anyway.

(3) Unless a user explicitly logs out (or completes some final action)
your system can't tell when a session has ended.

My answer would be to provide
* a log-out function (It will be forgotten but use a bit of psychology
to provide a useful information screen or 'here's your new look' as a
result to encourage its use.)
* a /warning/ that another admin session appears to be in progress
(including who is the other user) ...
* ...with a simple override.
* possibly the logic for 'is there another admin session in progress'
would look at recent activity in the audit trail and conclude that if
nothing has happened in the last 15 minutes then the new user can be
given control anyway.


--
PETER FOX Not the same since the e-commerce business came to a .
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Sep 25 '06 #6
Peter Fox a écrit :
>To do that, I need to check a flag in the database for any action in the
current session (to see if a new connection is active and close brutally
the current session if needed. I would like to avoid this check in db.

(1) You need to use something that all 'connections' can see and share.
Sessions don't fill this bill.
Yes.
>
(2) Since you will (won't you? - I would!) be recording access to the
admin system, you'll be keeping database records anyway.
I will.
(3) Unless a user explicitly logs out (or completes some final action)
your system can't tell when a session has ended.
Yes.
My answer would be to provide
* a log-out function (It will be forgotten but use a bit of psychology
to provide a useful information screen or 'here's your new look' as a
result to encourage its use.)
* a /warning/ that another admin session appears to be in progress
(including who is the other user) ...
* ...with a simple override.
* possibly the logic for 'is there another admin session in progress'
would look at recent activity in the audit trail and conclude that if
nothing has happened in the last 15 minutes then the new user can be
given control anyway.
I can't avoid to always check (in all scripts) if a new user is here and
stop if yes.
Thank you for the analysis.
--
Forje
Sep 25 '06 #7
Gordon Burditt a écrit :
Poking around the session save files of other sessions is a
possibility, but direct use of a database is probably more efficient
and less likely to cause trouble with two near-simultaneous login
attempts from different places.
It's hard to have access to all session files from a particular session.
How would you do that?
Sep 25 '06 #8
forje wrote:
Gordon Burditt a écrit :

>>Poking around the session save files of other sessions is a
possibility, but direct use of a database is probably more efficient
and less likely to cause trouble with two near-simultaneous login
attempts from different places.

It's hard to have access to all session files from a particular session.
How would you do that?
It's hard to do from the default session handler. However, you could
install a custom session handler, i.e. database driven, to handle the
sessions. Then you have easy access to all sessions.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 25 '06 #9
C.
1) PHP sesions aren't really intended to be left open indefinitely.
Apart from anything else its something of a security risk. The fact
that PHP will create a session when the one asked for does not exist
is, in itself a major security problem (see the links to session
fixation from the PHP site).

If exclusivity is the objective then this should be implemented using a
server-side mutex.

forje wrote:
Gordon Burditt a écrit :
Poking around the session save files of other sessions is a
possibility, but direct use of a database is probably more efficient
and less likely to cause trouble with two near-simultaneous login
attempts from different places.
It's hard to have access to all session files from a particular session.
How would you do that?
Write your own session handling functions which:

1) create a mutex and link the session to it if the session relates to
an exclusive process, and the mutex is not currently in use, or the
mutex is associated with an expired session.
2) when removing a session, unlink and close any corresponding mutex.

Of course (1) above assumes that any session has (at least) limited
visibility of other sessions - which in itself is a security problem.
However it would be really quite difficult to build a session handler
where this was not the case, and every one I've seen does not address
this.

HTH

C.

Sep 25 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Paul Munly | last post by:
Hi, I'm attempting to get a Swing application to go into Exclusive Fullscreen mode and am curious if there's something that I need to do prior to attempting to grab the fullscreen window. The...
3
by: Uwe C. Schroeder | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. I have the following little stored proc: CREATE OR REPLACE FUNCTION public.ib_nextval(varchar) RETURNS varchar AS 'DECLARE
1
by: Chuck Van Den Corput | last post by:
I have encountered a problem that I am hoping someone can shed some light on. I have a multi-user A97 app. All users have a personal front-end MDE accessing a shared back-end. There is no...
0
by: Wayne | last post by:
Can someone please help with this problem. When referring to opening a database in Exclusive mode the Access 2003 help says: "Under Default open mode, do one of the following: If you want others...
1
by: JohnC | last post by:
I have this exact same scenario. It is new and seems to be related to when we installed Adobe 7.0 Standard/Professional. We have an MDB on a LAN file server. Using Access 2K and Windows 2K. ...
1
by: University of Toronto | last post by:
Hi gang, Hopefully someone can help us out. In short - Access 2002, db split into a front end and back end. It appears that our backend db is locked. Our form bound to one table won't allow...
18
by: Andre Laplume via AccessMonster.com | last post by:
I have inherited a bunch of dbs which are are shared among a small group in my dept. We typically use the dbs to write queries to extract data, usually dumping it into Excel. Most dbs originated...
17
by: teddysnips | last post by:
One of my clients has asked me to make a change to one of their Access applications. The application is a Front End/Back End standard app. I didn't develop it, but looking at it tells me that...
3
by: Arun Srinivasan | last post by:
Please correct me if I am wrong 1. no 2 processes can have exclusive lock on same object (by object, same row or same table) 2. on deadlock incident between 2 processes only one of them will be...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.