Location: PHPKode > scripts > UsersOnline > usersonline/count_users.php
<?

//
//	hide@address.com
//
//	GPL'ed
//

require_once ( "users-online.php" );

//
// check if the user is behind an http proxy
//

if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
   $IP_ADDR = getenv( 'HTTP_X_FORWARDED_FOR' );
}
else if ( getenv( 'HTTP_CLIENT_IP' ) ) {
   $IP_ADDR = getenv( 'HTTP_CLIENT_IP' );
}
else {
   $IP_ADDR = getenv( 'REMOTE_ADDR' );
}

$o_user = new users_online ( $IP_ADDR );  // create the object and send user's IP

$o_user->main ();  // call the "main" method

?>

<b>Number of Users:</b> <?= $n_users = $o_user->count (); ?>

<?

// log the result into the database

$o_user->db_log ( $n_users ); // feeding the method with the result from $o_user->count (above)

// can also be used as:

$o_user->db_log ();

?>
Return current item: UsersOnline