This way, it would be possible to display the desired statistics on the websites.
-
Add this folder somewhere on the web server.
-
Run
composer require unrealircd/unrealircd-rpc:dev-main
-
Edit the file src/config.php.
-
Run your cron job on
/home/folder/unrealircd-sql-stats/src/stats.php
throwing it every 1 or 3 minutes.
If UnrealIRCd creates new keys and values in JSON logging, then delete your tables that start with "unrealircd_". Note that the tables are recreated automatically using the same columns as there are in the JSON logging.
SELECT * FROM `unrealircd_users`
SELECT count(*) as number FROM `unrealircd_users`
SELECT * FROM `unrealircd_channels` WHERE BINARY modes not like '%s%'
SELECT num_users FROM `unrealircd_channels` WHERE name='#vintage'
SELECT * FROM `unrealircd_name_bans` WHERE name='*snap*'
SELECT channels FROM `unrealircd_users` WHERE name='Bruno23'
This query selects all usernames from the "unrealircd_users" table where channel #Channel2 is present in the comma separated "channels" column :
SELECT name FROM `unrealircd_users` WHERE FIND_IN_SET('#Channel2', channels) > 0
The "FIND_IN_SET" function searches for the string '#Channel2' in the "channels" column and returns the position of the first occurrence in the string. If the string is not found, the function returns 0. The "FIND_IN_SET" function only works if the values are separated by commas, it will not work for other delimiters.
SELECT name FROM `unrealircd_users` WHERE channels REGEXP '(^|,)#Channel2(,|$)'