ohnoyekoms
05-14-2012, 06:17 PM
For this you'll need two .php files, one called loadtime, and load show. once you create loadtime.php drop this snippet within it..
<?
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$start = $time;
$count_my_page = ("views");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
?>
then you'll create loadshow.php which shows how long it took your server to load and process the page. so lets get to the snippet.
<?
$time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $finish = $time; $totaltime = ($finish - $start); printf ("<center><font color=white face=Verdana size=1>loaded in %f/ms. and $hits[0] views.</center>", $totaltime);
?>
so now we have the php files required for this. okay lets begin.
on the page you want to show a load time, at the top of the page, put <? include('loadtime.php'); ?> this will start the counter, it will also add a number to the page visit counter. then at the bottom right above your </html> put, <? include('loadshow.php'); ?> this will print out the load time.
and thats pretty much it. depending on where you put loadshow.php is where it quits the timer.
<?
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$start = $time;
$count_my_page = ("views");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
?>
then you'll create loadshow.php which shows how long it took your server to load and process the page. so lets get to the snippet.
<?
$time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $finish = $time; $totaltime = ($finish - $start); printf ("<center><font color=white face=Verdana size=1>loaded in %f/ms. and $hits[0] views.</center>", $totaltime);
?>
so now we have the php files required for this. okay lets begin.
on the page you want to show a load time, at the top of the page, put <? include('loadtime.php'); ?> this will start the counter, it will also add a number to the page visit counter. then at the bottom right above your </html> put, <? include('loadshow.php'); ?> this will print out the load time.
and thats pretty much it. depending on where you put loadshow.php is where it quits the timer.