Also, to show hostname for guests:
Find:
echo "<td>".$row['session_ip']."</td>\n";
Add this below
echo "<td>".gethostbyaddr($row['session_ip'])."</td>\n";
Btw, i had modified this "echo "<td>".gethostbyaddr($row['session_ip'])."</td>\n";"
And now I can do whois lookup for guest to, just replace it with:
echo "<td><a href=\"".$ip_whois_link.$row['session_ip']."\" target=\"_blank\">".$row['session_ip']."</a></td>\n";