Jump to content

Problem when user navigate away from my site.


satyac46

Recommended Posts

Dear friends

 

Please go through this one and think little bit what i am asking.

 

When ever user log in to my site and with out log out he type another url on address bar such as yahoomail.com .And navigate away from my site.From there he used back button to came back to my site. But the user still looks login.

 

What i need is, he should logout when he moves away from my site.

 

Any body can suggest how to achieve this one using javascript or PHP.if possible help with some code.

 

An advanced Thanks for every one

 

 

 

Link to comment
Share on other sites

You can only set a timer to kill the session, cookie, or both. A page refresh on your site resets the timer. There is a tutorial here at PHP Freaks regarding session timers.

 

Basically, a server just sits and listens, it doesn't 'watch'. If it receives a request, it reacts. It has no idea if someone previously sending requests ends up requesting something from another website. It only knows how long it's been since the last request.

 

PhREEEk

Link to comment
Share on other sites

Yes,You said correct.But, is there any way to solve this one through javascript

 

1.on unload to get the typed URL.

2.Or getting the previous URL when user came back to site using javascript.

 

Please consider to set it to all the site.

To logout my user.

 

Thanks for your help

Link to comment
Share on other sites

I don't think it is possible.  You will notice that banks don't even do this, which is something that would be a great security issue and fixed if it were possible. 

 

The way I setup my login information is sessions, the default is usually 20 minutes without activity or if the browser is closed, the sessions are deleted.   

Link to comment
Share on other sites

I have no idea why some website owners are so preoccupied with trying to control the User's browse session. The thinking has always been "I want as many customers on my site, and/or logged in as possible", which makes smart business sense. So, if a User runs off to check his gmail or whatever, and then comes back, we would want him to be logged back in! If we force a new login when he only left our site for 2 minutes, he might get PO'd and leave our site COMPLETELY. Losing site Users is not something most webmasters dream of achieving.

 

Luckily, a website has no idea whatsoever that we have left to go check our email, unless we ELECT to logout first.

 

Anyways, quite a bit of energy has been spent trying to accomodate the OP's control issues, but I would like to hear from the OP himself, why exactly this is so mission critical?

 

PhREEEk

Link to comment
Share on other sites

Hi every one

 

Thanks for your approach.But i did not get what i required.

As i have a still some hope on this issue.Because i saw this one in one bank website.but it was done in JSP.I am looking to achieve in php or javascript.As my site is completely done with php.Regarding the above reply what i can say,it is a website corporate website it will be used as tool.

 

Thanks

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.