mIRC Homepage

Script to see the amount on online users on a site

Posted By: kurtie

Script to see the amount on online users on a site - 17/08/08 08:08 AM

Hello everyone smile

I'm looking for a script which allows me to post a link on my websites to the chat, but I want to include after that link the amount of online users.

For example: chatlink (12 online)

Can someone help me please?
Posted By: Strider

Re: Script to see the amount on online users on a site - 17/08/08 08:58 PM

I don't know the setup of your HTTP server and which scripting language you're using, but here are some ideas:

If your computer is the HTTP server, then a simple solution would be writing (and updating periodically) a file to a path reachable by the scripting language (PHP, for example) and then reading the file and creating the markup for the link each time a user requests the page where you want to show it.

If the HTTP server is somewhere else, then you could create a "secret" page that receives a query string or POST parameter and then uses it to update either a file or a value in an SQL database. All you would need to do is to access this page with mIRC periodically while sending the number of users as the parameter. Then you would have to read the file or database value to create the markup for the link each time a user requests the page where you want to show it.

These solutions are mIRC-based, but the optimal one would be not using mIRC at all, but an independent process that updates the value.
Posted By: vexx0r

Re: Script to see the amount on online users on a site - 18/08/08 06:47 AM

What kind of chat software are you using? If you are using chatspace it has a built in feature to grab the users in a specific chat room by calling a variable I.E. %USERS%. Otherwise I would perform a custom /who and count the different idents or rooms chatters are in and inc them accordingly. For instance you could type /who chatlinks in which case your custom /who script would count the users in chatlinks and display a total. Then you could sock write that to a file every so often. I have done this both ways and if you are using chatspace it is much easier. Yet not impossible the other way. Also, You could program a php bot to connect to the server and join the room, that would get an accurate count every time someone viewd the page. though it wouldn't have an automatic refresh without javascript or ajax or something similar. Good luck.
© 2021 mIRC Discussion Forums