I think this code will help you an idea.
CODE
<?php
$user=$HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'];
echo"Online User:<br>";
echo"$user";
echo"I'm still working for the complete code :D i'm just giving you an idea.";
?>
But, that's not enough, i'm still working on it.