On Fri, July 27, 2007 8:55 am, Erfan Shirazi wrote:
> I have a problem which I need some help with.
> I have a e-commerce site were the user must log in in order to use
> some
> of the functions. But I only want 1 active session for each user, so
> the
> user should not be able to have 2 browsers opened and being able to
> log
> in with both.
>
> So I need to somehow know the difference between when a user has just
> shutdown the browser without correct login and when the user has
> logged
> out correctly.
>
> Today we use DB in order to make this happen but then the user is able
> to login twice but as soon as he clicks on something (new PHP call) in
> the previous session he gets kicked out from his previous session.
>
> I want to somehow see if the user already has a browser opened with a
> active session and tell him to use that one instead. And if the
> browser
> is closed but he has not logged out correctly then he should be able
> to
> log in again.

There is absolutely nothing you can do that's 100% reliable (or even
close) to do this...

One hack is to put some kind of Ajax-y thingie in the HTML to notify
the server when the page is unloaded.  Won't work if JavaScript isn't
running, makes the site seem "slow" when they go to close a window,
and is pretty annoying all around.

It might be better to re-think your needs...

Does it really matter if they open up another browser and start over?

If it's happening a lot, then that probably means there is something
broken on your site in a browser-specific way that is forcing them to
switch.

Nobody who's seriously shopping just abandons their cart and starts
over with a new browser just for "fun" :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to