Measure time between php scripts 02-13-2014, 08:20 PM
#1
Hello everyone.
I would really like some help with the following:
So, I am currently working on a PHP rating system where each time two pictures are presented to every visitor and he chooses the best in his opinion. At this point I would like to know how much time is spent from the time someone clicks on an image (meaning that selects it) since the next page load (with new images).
The problem here is that i am using two php scripts that do the whole work and from what I have seen on the Internet there is no free script that can measure time between more than one php loading script.
How is this working?
Simply at the index page two random numbers are generated which will be the ID of each image in the mysql database and using these IDs the images will be printed on screen.
Now these images work like links. When someone clicks on one of the two the data of the vote are transfered (images are links) to another php script that actually does the whole work ,counting and calculating everything that will be put in the database and when this script and when this script has run all the commands it redirects the visitor back to the index page and where two other images will be printed for him to choose.
I want somethink like a calculator to start at the top of the index page and to end when the second script is over and it will redirect back to the index page.
I have found this but works only when one php script is used:
This part goes before the main commands:
And this part goes at the end and prints the result:
Please help. Thanks in advance!
-ReTi0n
I would really like some help with the following:
So, I am currently working on a PHP rating system where each time two pictures are presented to every visitor and he chooses the best in his opinion. At this point I would like to know how much time is spent from the time someone clicks on an image (meaning that selects it) since the next page load (with new images).
The problem here is that i am using two php scripts that do the whole work and from what I have seen on the Internet there is no free script that can measure time between more than one php loading script.
How is this working?
Simply at the index page two random numbers are generated which will be the ID of each image in the mysql database and using these IDs the images will be printed on screen.
Now these images work like links. When someone clicks on one of the two the data of the vote are transfered (images are links) to another php script that actually does the whole work ,counting and calculating everything that will be put in the database and when this script and when this script has run all the commands it redirects the visitor back to the index page and where two other images will be printed for him to choose.
I want somethink like a calculator to start at the top of the index page and to end when the second script is over and it will redirect back to the index page.
I have found this but works only when one php script is used:
This part goes before the main commands:
PHP Code:
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
And this part goes at the end and prints the result:
PHP Code:
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo 'Page generated in '.$total_time.' seconds.';
Please help. Thanks in advance!
-ReTi0n





![[Image: Animated-Flag-Greece.gif]](http://images.wikia.com/merlin1/images/e/eb/Animated-Flag-Greece.gif)
![[+]](https://sinister.li/images/modern/collapse_collapsed.png)

![[Image: wvBFmA5.png]](http://i.imgur.com/wvBFmA5.png)
