Jump to content

Measuring time on a page


yoda69

Recommended Posts

There is no active connection between the server and the client with php.

 

All you can do is Guesstimate - Set a timestamp for the current page the user requested, once the user changes/;requests a new page, reset the timer. Though once the user leaves the last page would be a long time so the last page is the most inaccurate.

 

Even though you cant really tell how long someone is looking at a page (which is more releveant than being on a page and not looking).

 

Basically you can get estimatesd but never a relevant exact accurate number.

 

-CB-

And as i said, unless you have some extremely sophisticated webcam recognition software that could magically tell between different people, you just cant do it accurately. You will only get a guide, and the easiest guide is an average of time spent on all your pages. By tall ying up the times between page requests.

 

-CB-

You could save the current time on the form page and then save the time when submitted and compare the two?

And what if someone navigates away from the page and then return a few days later?

 

Well his actual question was to see when a submit button was pressed after the page had been loaded. So a timestamp easily takes care of this problem with no issues.

 

1) Page loads

2) Timestamp is set

3) User clicks submit button

4) Submission code executes + 2nd timestamp is set

 

fail safe ;)

Yeah if you want to be really accurate use microtime() (it gives an array, just add both together.)

 

If it is a test, then it wil be by someone willing/interested - So you can assume most will follow your rules (not going back for ex.).

But, they will cheat etc, but if its like an iq test it doesnt matter if they cheat, cuz if they arent honest it will be false anyway.

 

I reccommend testing it yourself, and doing everything you can think of to it, then put it up on the website security check forum (or w/e), get people to tell you what they find is wrong.

 

o btw - it helps if the topic is marked as solved. Cheers.

 

-cb-

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.