in reply to Current time as variable?

I don't know what the purpose of the timer is, but I thought I'd let you know of a potential risk factor if it is important that it not be faked. If you place the initial time in a hidden form variable a clever individual should be able to fake their test time.

A better solution might be to use something like CGI::Session to store the initial time on the server and a session id on the client via your hidden form variable (or in a cookie or URL) to make certain that the timer is not abused.

Replies are listed 'Best First'.
Re: Re: Current time as variable?
by Grygonos (Chaplain) on Dec 10, 2003 at 20:12 UTC
    This is the way I've always done it.
    my $start = time; #do your work/quiz/etc. my $end = time; my $time_taken = $end-$start; print "Quiz/Work/Etc... took".$time_taken." seconds\n";
    You can take the resultant epoch seconds and split them out into hours and minutes using some basic math.

    Grygonos