Madriix / unrealircd-sql-stats

UnrealIRCd SQL Stats
MIT License
1 stars 0 forks source link

display #1

Open umutcaptain opened 2 weeks ago

umutcaptain commented 2 weeks ago

how can i display users on my website can u describe it ?

thx

Madriix commented 2 weeks ago

Here is an example of php code using mysqli :

<?php
$host = 'localhost';
$user = 'your_username';
$password = 'your_password';
$database = 'your_database_name';

$conn = new mysqli($host, $user, $password, $database);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT * FROM unrealircd_users";

$result = $conn->query($sql);

if ($result->num_rows > 0) {
    echo $result->num_rows." results";
    // Loop through the results
    while($row = $result->fetch_assoc()) {
        // Display data for each row (example with `id` and `name` columns)
        echo "ID: " . $row["id"]. " - Nickname: " . $row["name"]. "<br>";
    }
} else {
    echo "0 results";
}

$conn->close();
?>
umutcaptain commented 2 weeks ago

tyvm.

my fault is at logs

Warning: Undefined variable $pdo in /var/www/vhosts/ayna.org/httpdocs/istatistik/src/tables/unrealircd_users.php on line 4

Fatal error: Uncaught Error: Call to a member function query() on null in /var/www/vhosts/ayna.org/httpdocs/istatistik/src/tables/unrealircd_users.php:4 Stack trace: #0 {main} thrown in /var/www/vhosts/ayna.org/httpdocs/istatistik/src/tables/unrealircd_users.php on line 4

i will try this code then i ll give feedback.

umutcaptain commented 2 weeks ago

users worked very well

i wanted to show user counts in #abc channel but i ve seen that there is no any creation of unrealircd_channel database and at my phpmyadmin i ve never seen any channel name. But users database is working very well. fyi.

umutcaptain commented 2 weeks ago

i deleted unrealircd_channels.php and auto or manually it does not create unrealircd_channels.php

it gives error too fyi.

Madriix commented 2 weeks ago

Is it the unrealircd_channels SQL table that isn't being created, or is there an issue with the PHP file (unrealircd_channels.php)? Check if you have the necessary database permissions.

umutcaptain commented 2 weeks ago

https://ayna.org/istatistik/ayna.php

unrealircd_users.php is working well.

unrealircd_channels.php came back when i check stats.php but it is empty. not getting the channel list

but unrealircd_channels.php is empty when i check there. trying to catch count of channel total users.

Madriix commented 2 weeks ago

Do you see the 'unrealircd_channels' table in PhpMyAdmin ?

I didn't quite understand, what do you want to display on the page ?

umutcaptain commented 2 weeks ago

i see unrealircd_channels table yes but it is empty. ( if it has to be empty, pls accept my apologise abt that )

i want to display " total users (count) in #a, #b, and #c channels" and total users (count) in whole network.

Madriix commented 2 weeks ago

It's not normal that it's empty

umutcaptain commented 2 weeks ago

when i wanted to upload unrealircd_channels.php manually, it given errors. idk what can i do

my unrealircd version is : unrealircd 6.1.7 ( last stable version ) and webpanel last stable version too.