I cannot give you an answer to how to implement this with the forum software you are using. I've checked the site and they have forum for mods and plugins, so you might want to ask there if this has to be a plugin (unless someone here knows it of course).
To find out the IPs of all users currently logged in to your site, you could do something along the lines of this (we define currently logged in as 'has a session'):
// put in your bootstrap after you defined getRealIpAddr()
if(session_id() === '') {
session_start();
}
$_SESSION['ip'] = getRealIpAddr();
Then in your lib add a SessionReader class, e.g.
class SessionReader
{
// serializes session data without destroying your own session
public function decode($filecontent){
// see http://de.php.net/manual/de/function.session-decode.php#69111
}
// just reads in the contents of a session file
public function readSessionData($file)
{
return file_get_contents(realpath("$session_save_path/$file"));
}
// returns all filenames in save path starting with 'sess'
public function getSessionFiles()
{
$path = realpath(session_save_path());
return glob($path . '/sess*');
}
// uses the above methods to build an array of all decoded sessions
public function getEveryonesSessionData()
{
$contents = array_filter($this->getSessionFiles(),
array($this, "readSessionData"));
return array_filter($contents, array($this, "decode"));
}
}
To use it, do
$sessionReader = new SessionReader;
foreach( $sessionReader->getEveryonesSessionData() as $session) {
echo $session['IP'];
}
Disclaimer: this is just a proof of concept aka ugly hack. I don't expect this to work without adjustment. so you shouldn't either. But you should be able to get it done from here.
The SessionReader should be able to read in all session files in the session_save_path specified in the PHP.ini or elsewhere in your app. The assumption is, session files start with sess and are stored in the file system. When calling getEveryonesSessionData(), the class will find, read, decode and return all session files in an array, so you can access them one by one.
To get this running with your forum software, you have to find out how they define currently logged in users and if and how they use sessions.