set timer on page access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • king1986
    New Member
    • May 2007
    • 2

    set timer on page access

    hello everybody,
    I'm a new member here, and I'm happy to be with you.
    Please I'm a student and I need to finish my project as soon as possible, but I have a problem. Actually, my project is to do online exam system using php and Mysq and I need your help in php. I want to create a timer using php that will start counting the time when the student access the test page until it reach 10 minutes then it will submit the page and insert the data in to the database.
    Please, I really need your help as soon as possible, and I will be grateful to you.
    Thanks...
  • king1986
    New Member
    • May 2007
    • 2

    #2
    Please I need your helllllllllllp

    hello everybody,
    I'm a new member here, and I'm happy to be with you.
    Please I'm a student and I need to finish my project as soon as possible, but I have a problem. Actually, my project is to do online exam system using php and Mysq and I need your help in php. I want to create a timer using php that will start counting the time when the student access the test page until it reach 10 minutes then it will submit the page and insert the data in to the database.
    Please, I really need your help as soon as possible, and I will be grateful to you.
    Thanks...

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      You have posted in the Articles section. I am moving this question to the PHP forum.

      ADMIN

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Originally posted by king1986
        I want to create a timer using php that will start counting the time when the student access the test page until it reach 10 minutes then it will submit the page and insert the data in to the database.
        Unfortunately, you can't do this directly with PHP. You can use JavaScript's setTimeout function to do this, or you could use a META tag (search for 'http-equiv=refresh') , though this wouldn't force the form to submit.

        Alternatively, you could put each question on a separate page. On the first page, the program would set a session variable (we'll call it 'timeout') equal to the current time plus ten minutes (make sure you check for an existing timeout so Users can't cheat the system!).

        When the User tries to load a page, you could then compare the stored timeout value to the current time. If $_SESSION['timeout'] <= time(), then the User's SOL, and he can't continue.
        Last edited by pbmods; May 7 '07, 11:33 PM. Reason: Forgot an 'a'. Here's a few more in case I missed some -> aaaaa

        Comment

        • MMcCarthy
          Recognized Expert MVP
          • Aug 2006
          • 14387

          #5
          To avoid confusion. These two threads have been merged.

          ADMIN

          Comment

          Working...