473,395 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

session destroy for while user stay in one page without any action

oranoos3000
107 100+
hi
I 'd like to session destroy when that user for 1 hours dont dont press any key or scroll page and dont go to another or in other words stay in one page for a alot of time


thanks alot
Jun 6 '10 #1
1 2025
Atli
5,058 Expert 4TB
Hey.

If you want to detect when a user presses a key or scrolls the page, and destroy a session based on that, you will need to use JavaScript and AJAX to trigger the PHP code that actually destroys it.

To do what you are asking, I would do the following:
  • Set PHP up so that the session times out after an hour. See this article for details on how to do that.
  • Create a PHP ping page that simply "refreshes" the session timeout. It wouldn't have to do anything other than start the session and update whichever timeout method you use (if any).
  • Have the JavaScript code monitor the user input. When the user is active, send periodic AJAX requests to the PHP ping page. If he becomes inactive, stop sending the AJAX requests.
The result of this would be that while the user is actively working on a page of your site, his session would remain alive, even though he never really requests anything from the server.
Jun 7 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: David Young | last post by:
I normally work on WinForms projects, but have been recently thrust into this arena and had a questions concering access to objects stored in session. We've apparently got an object (custom...
1
by: twscott | last post by:
I will be posting information to another application from my applicatio and redirecting to that application which will load into anothe iteration of IE. The user may spend a significant amount of...
6
by: Alan Silver | last post by:
Hello, I have a page where users can alter the contents of a shopping basket. Once they are happy with the contents, they click a "checkout" button and are taken to the checkout page. What...
4
by: UJ | last post by:
I have a page where the user can upload a video file. As you can guess, this may take a while. Is there a way I can change the session timeout for just this one page? I would also want to change...
1
by: Owen Richardson | last post by:
I have an asp.net website where i have a quick search facility built into my master page. the search is a web control, with a drop down country box and a list box full of cities. When i select...
4
by: Nick Gilbert | last post by:
Hi, Is it possible to access the Session of an arbitary user from an aspx page? On an e-commerce site, I am notified of payment success via a callback from the payment server to an ASPX page...
4
by: Sam | last post by:
I have an asp.net 2.0 app that uses a sitemap, Master Page, and has several content pages. While this feature has simplified the process of creating a data-driven site menu, it does seem to have...
38
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
5
by: Steve D | last post by:
I am not sure where to post this as it probably a combination of client and server script I am looking for. Basically I am trying to find out how to destroy a PHP session when the user navigates...
3
by: T. Wintershoven | last post by:
Hi all, After a visitor has loged in, a session is started. The session is destroyed after the visitor clicked "Log out'. When the visitor forgets to log out and closes the browser...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.