473,383 Members | 1,877 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,383 software developers and data experts.

Session Destroy For While User Stay In One Page Without Any Action?

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
Dec 6 '12 #1
3 1859
I am thinking session_unset()

check this out!

http://php.net/manual/en/function.session-unset.php
Dec 6 '12 #2
or even some variant of this should help
Expand|Select|Wrap|Line Numbers
  1. session_start();
  2.  
  3.  
  4. // set timeout period in seconds
  5. $inactive = 600;
  6. // check to see if $_SESSION['timeout'] is set
  7. if(isset($_SESSION['timeout']) ) {
  8.     $session_life = time() - $_SESSION['timeout'];
  9.     if($session_life > $inactive)
  10.         { session_destroy(); header("Location: logoutpage.php"); }
  11. }
  12. $_SESSION['timeout'] = time();


Note the session_destroy() in this example, it destroys all the session vars as opposed to session_unset which simply clears them.
Dec 6 '12 #3
Dormilich
8,658 Expert Mod 8TB
I 'd like to session destroy when that user for 1 hours dont dont press any key or scroll page […]
PHP will never get any note of this, since that are client side UI actions that do not make it to the server.

essentially, you do not even need to do anything except setting the session GC to the appropriate values (the session destroys itself after a set time, also called session timeout).
Dec 7 '12 #4

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...
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...
1
oranoos3000
by: oranoos3000 | last post by:
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.