Go Back TO Main Page if There is no Interactivity within certain time. HELP NEEDED!

Discussion in 'PHP' started by NazStory, Mar 16, 2010.

  1. #1
    i'm developing some kinda interactive kiosk system using wordpress PHP that runs locally.

    I need a script that redirect user within specific amount of time if there is no interactivity.

    for example, when a user done browsing the system for information, they wouldn't go back to the main menu. I need a script that does that, if nobody doing anything fr like 30sec, it'll go back to the main menu (homepage)

    i'm using wordpress runs locally with XAMMP.

    THANKS in advance!
     
    NazStory, Mar 16, 2010 IP
  2. YoGem

    YoGem Active Member

    Messages:
    676
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    90
    #2
    Mmm... I think you can do something, by adding at the beginning of the page a

    
    <BODY onLoad="TheTimer()">
    
    Code (markup):
    the function TheTimer:
    
    <script language="javascript">
    redirTime = "30000"; redirURL = "insert_a_valid_url";
    function TheTimer() { var ti; ti=self.setTimeout("self.location.href = redirURL;",redirTime); }
    </script>
    
    Code (markup):
    and

    
    function StopTimer() { clearTimeout(ti); }
    
    Code (markup):
    Then adding a <span onmouseover="StopTimer(); TheTimer();">--the-page-goes-here--</span> in the page that will reset the timer if there's a mouse movement over it (mouse_over), the javascript in the meantime at the end of 30 seconds will redirect the users to the main page. Really easy...

    I haven't tried it! But it should work.
     
    Last edited: Mar 16, 2010
    YoGem, Mar 16, 2010 IP