//place that code in page header page where you want to get online user


/* Page that uses an AJAX request to "ping" a page on the server to indicate a page from this site is still being displayed in the browser.
Passes a parameter on the end of the url that could be used, for example, to log which page a visitor is on.
This example pings/requests the page - keepalive2.php */
var page_to_request = 'onlineUser.php';

/* The page_to_request returns a text response that is displayed in the tag with the id in response_id */
/* In this example code, this text response will be the number of members online */
var response_id = 'response';

/* This page shows a count in c to indicate it is doing something */
var c=0;
var t;
function startTime()
{
	document.getElementById('counterdisplay').innerHTML=c; // display activity count
	c=c+1; // increment activity count to show page is doing somtheing
	t=setTimeout('startTime()',30000); // how often to ping the server (30000 = 30 seconds)
	ajaxkeepalive('main.php'); // pass a string (this page name...) to the server as part of the AJAX http request
}

/*dont forget to place below code to place inside that body tag
<span id="counterdisplay" style="display:none"></span><span id='response' style="display:none"></span>
*/