Hey,
I'd be happy to share the stats scripts with you as I got most of them through tutorials off P2L
Here is my navigation scripts
<?php
$file = 'counter.txt';
if(!file_exists($file))
{
$handle = fopen($file, 'w');
fwrite($handle, 0);
fclose($handle);
}
$count = file_get_contents($file);
$count++;
if(is_writable($file))
{
$handle = fopen($file, 'w+');
fwrite($handle, $count);
fclose($handle);
}
else
{
echo 'Could not increment the counter!<br />';
}
echo number_format($count).' Hits';
?>
<p>
<?
$timemax = "300"; //Max. time that users are online on your site (in sec.)
$ipadress = $REMOTE_ADDR;
$timenow = explode (" ", microtime());
$timenow = $timenow[1];
include ("data.php");
$timedelete = $timemax;
$deleted = $deleted + $timedelete;
if ($deleted < $timenow){
$file = fopen("data.php","w+");
fputs($file, "<?PHP \$deleted = \"$timenow\"; ?>\n");
$number = count($visitor_b);
for ($tel = 0; $tel < $number; $tel++){
$visitor_a = $visitor_b[$tel];
$visitor_a[0] = $visitor_a[0] + $timemax;
if ($visitor_a[0] > $timenow)
fputs($file, "<?PHP \$visitor_b[] = array('$visitor_a[0]','$visitor_a[1]'); ?>\n");
}
fclose($file);
}
$visitor_b = "";
include ("data.php");
$number = count($visitor_b);
for ($tel = 0; $tel < $number; $tel++){
$visitor_a = $visitor_b[$tel];
if ($visitor_a[1] == $ipadress)
$save = "nee";
}
if (!$save){
$file = fopen("data.php","a");
fputs($file, "<?PHP \$visitor_b[] = array('$timenow','$ipadress'); ?>\n");
fclose($file);
}
$visitor_b = "";
include ("data.php");
$number = count($visitor_b);
for ($tel = 0; $tel < $number; $tel++){
$visitor_a = $visitor_b[$tel];
$visitor_a[0] = $visitor_a[0] + $timemax;
if ($visitor_a[0] > $timenow)
$online = $online + 1;
}
if (!$online)
$online = 1;
if ($online == 1)
print ("Users Online: $online");
else
print ("Users Online: $online");
?>
<p>
<?
echo ("Page loaded in $time seconds.");
?>
<p>
And theres a section in the head
<?
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
for ($i=0; $i <1000; $i++){
}
$time_end = getmicrotime();
$time = $time_end - $time_start;
$time = round($time,6);
?>
All the text files you have to create ( counter.txt ) needs to be CHMOD'd to 777
- Dan