in reply to Timer for web page display

This is a little OT, but it all depends on what you want to happen next.

Do you want to submit the quiz? Are you forcing users to have JavaScript enabled? If so, you can do something like the following (untested):

# in head part of html output <SCRIPT LANGUAGE="JavaScript"> <!-- setTimeout(1200,'document.form_name.submit()'); // --> </SCRIPT> # and when defining the form, give it a name <FORM ACTION="wherever" NAME="form_name" method="post">

That should submit the form for you after 20 minutes.

If you just want to load a new page, look at META redirects.

cLive ;-)

Replies are listed 'Best First'.
Re: Re: Timer for web page display
by TGI (Parson) on Jul 17, 2001 at 03:00 UTC

    Of course if I wanted to cheat, I'd just disable javascript and take my time on the quiz...

    I hate to say it, but you might be better off with a java applet. It'll be harder to f**k with (an enterprising user could play with the system clock...)

    UPDATE: mugwumpjism is correct that careful serverside validation should obviate the need for Java usage (good riddance). I don't know what I was thinking. I take comfort that my paranoia survived my muddy thinking. Trust not the client!


    TGI says moo

      Easily avoidable. Record somewhere the time that you issued the quiz to that session. On subimssion, check that it has been submitted within the allowable timespan.

      Or, encrypt the time that it was sent in a hidden field. When you get the form back decrypt the time.

      Remember to include somewhere the mention that attempts to circumvent the time limit will void the quiz entry.

      The key here is use three methods:

      1. Instruct the user to take less than 20 minutes on the test.
      2. Instruct the browser to automatically submit the form after 20 minutes using the javascript in above posts
      3. Enforce in the CGI script, by securely associating each issue of the quiz with a time, either stored locally or securely encrypted in the form.
      srand 3.14159; print join("", sort{rand 1<0.5}map{$_^"\037"}split m{ }x,"qmptk|z~wOzm??l]pUqx^k?j"),",\n";