Jump to content

Website Statistics


hex4

Recommended Posts

I'm trying to create a statistic blog for my website but I'm having some problems.

 

1) Showing all online members

- Currently I have this:

 

$timeoutseconds = 60; //1 minute

$timestamp = time();
$timeout = $timestamp-$timeoutseconds;

$insert = mysql_query("INSERT INTO useronline VALUES ('" . $timestamp . "','" . $_SERVER['REMOTE_ADDR'] . "','" . $_SERVER['PHP_SELF'] . "')") or die(mysql_error());
$delete = mysql_query("DELETE FROM useronline WHERE timestamp < $timeout");
$result = mysql_query("SELECT DISTINCT ip FROM useronline");
$users = mysql_num_rows($result); 
echo $users;

 

This script get the amount of users online for the latest minute.  What i wish is that the idle online users are kept as well but when the window/browser is closed then the online counter decreases.

 

2) I want to differ between members and guests. 

Members Loggin In:

Users can have the cookies enabled and hence they log in without pressing the Login Button.

Members Loggin Out:

Most of the time users logout without pressing the logout button and just by closing the window/browser.

 

how do i realise that the users joined and left the website without using any buttons from my site?

Link to comment
https://forums.phpfreaks.com/topic/68683-website-statistics/
Share on other sites

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.