+ Reply to Thread
Results 1 to 4 of 4

Thread: Controling time of user inaction

  1. #1
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    Controling time of user inaction

    Hello.

    On my page (written with php, mysql, html) after a user has connected himself (giving user name and password), the menu is changed, according to his "hierarchical level".

    I want to be sure he doesn't stay connected without action over a certain delay.

    How can I do that ? Does a javascript function controled by timeout(xx,nn) can be a good way for that, or are there better ways ?

    Thanks.
    Last edited by fomalhaut; 12-04-2009 at 02:15 PM.

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Controling time of user inaction

    One way would be to store the "last time logged in acted" along with the session info.

    Each time he accesses a page, check the time.

    If it has been too long, log him off and redirect to log-in page (store the URL he wanted in session info so you can send him there after he successfully logs back in).

    If he is OK, update the timestamp and give him the page.

    You can also "kick him off the page", ie set window.location= "loginpage.php" by using a timeout created in a window.onload handler.
    Last edited by descalzo; 12-04-2009 at 03:21 PM.

  3. #3
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    Re: Controling time of user inaction

    Thank you, Descalzo for your help.

    I presume it is possible to test any event, such as mouse click, or key down, anywhere on the page, probably in the "body" section, not only access to new page ?

    I'll try that.

    Thanks again. ;)

  4. #4
    drf1229 is offline x10Hosting Member drf1229 is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    71

    Re: Controling time of user inaction

    If you are using cookies for your login sessions you can set the expiration time of each cookie.
    Your 14 year old web developer. If I can do it, you can!
    My site
    My iPhone App

+ Reply to Thread

Similar Threads

  1. Multiple date & time support
    By phpasks in forum Programming Help
    Replies: 19
    Last Post: 11-28-2008, 10:55 AM
  2. Trouble With Database and PHP Time
    By rforum in forum Free Hosting
    Replies: 4
    Last Post: 08-26-2008, 11:37 PM
  3. Cpanel down and my web site down. All the time
    By mgiannel in forum Free Hosting
    Replies: 3
    Last Post: 12-23-2007, 09:54 PM
  4. More time to create website
    By -Daniel in forum Feedback and Suggestions
    Replies: 6
    Last Post: 07-03-2005, 04:34 PM
  5. Do we use the Ranking system here?
    By Cycloneflame in forum Off Topic
    Replies: 14
    Last Post: 04-28-2005, 10:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers