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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.