Jump to content

users online script


anthonyw17

Recommended Posts

ok so i been workin on a script that shows if a server is online/offline (got that working) but now i want to get it for it can show users that are online on a ip address and port heres the code that shows if the server is online/offline

 

<?php
$IP = array(
"ip1:" => "85.13.214.87:9998"
);

while(list($ServerName,$Host)=each($IP))
{
    list($IPAddress,$Port)=explode(":",$Host);
    if($fp = @fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,5))
    {
        fclose($fp);
        echo "<img src='online.gif'> <font color='green'>Online</font><br>";
    }
    else
    {
        echo "<img src='offline.gif'> <font color='green'>Offline</font><br>";
    }
}
?>

 

so if someone could help me figure out how to make it show the number of users that are connected to: 85.13.214.87:9998 and for it prints somehting like "Users: #" i would love you, thanks

Link to comment
https://forums.phpfreaks.com/topic/170332-users-online-script/
Share on other sites

You can't. Is 85.13.214.87 your server? If it is than on port.. 9998 you must define a gateway that writes the user to a temporary file that'll expire after X amount of minutes.. which will display the current online users in a more or less accurate method, that's what sites do to list online users..

Link to comment
https://forums.phpfreaks.com/topic/170332-users-online-script/#findComment-898562
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.