Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Current time as variable?

by hanenkamp (Pilgrim)
on Dec 10, 2003 at 20:01 UTC ( [id://313840]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://313840]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-03-29 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found