PDA

View Full Version : Stats Help



iNicks
25-02-2006, 10:48 PM
Ok is there a site where I can get stats put on my site like "Habbos Online: 3". Like on Habbox, and it also says the hits?

Bomb-Head
25-02-2006, 11:19 PM
Try searching on google = Website statistic script or something like that ?

Raremandan
25-02-2006, 11:33 PM
The users online is actually a really simple PHP code, you can get advanced ones including MySQL but seeing as you may not have SQL knowledge i'll show you the simple way.




<?

$timemax = "500";

$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");

?>



Now you need to create a file called data.php and CHMOD it too 777 and upload it onto your server.

Want to hide these adverts? Register an account for free!