]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - misc/user-lookup-misc.php
Search: Make vaguely wildcard-y
[irc/unrealircd/unrealircd-webpanel.git] / misc / user-lookup-misc.php
index fe8d9c675d92ed9e4487516295593e229df3739b..cb6a4a730a2ee98e9a094822f22c2ca29223d018 100644 (file)
@@ -6,10 +6,14 @@ function generate_html_whois($user)
        
        $notes = Notes::find(["nick" => $user->name, "ip" => $user->ip, "account" => $user->account ?? NULL]);
        $numnotes = [
-               "ip" => isset($notes['ip']['notes']) ? count($notes["ip"]['notes']) : [],
-               "nick" => isset($notes['ip']['notes']) ? count($notes["nick"]['notes'] ?? []) : [],
-               "account" => isset($notes['ip']['notes']) ? count($notes['account']['notes'] ?? []) : [],
+               "ip" => isset($notes['ip']['notes']) ? count($notes["ip"]['notes']) : 0,
+               "nick" => isset($notes['ip']['notes']) ? count($notes["nick"]['notes'] ?? []) : 0,
+               "account" => isset($notes['ip']['notes']) ? count($notes['account']['notes'] ?? []) : 0,
        ];
+       $cc = (isset($user->geoip->country_code)) ? strtolower($user->geoip->country_code) : "";
+       
+       $asn = $user->geoip->asn ?? "none";
+       $asname = $user->geoip->asname ?? "none";
        
        ?>
 
@@ -35,9 +39,10 @@ function generate_html_whois($user)
                                <td colspan="2"><code><?php echo htmlspecialchars($user->hostname); ?></code></td>
                        </tr><tr>
                                <th>IP</th>
-                               <td colspan="2"><code><?php echo htmlspecialchars($user->ip); ?></code>
+                               <td colspan="2">
+                                       <code><?php echo htmlspecialchars($user->ip); ?></code>
                                <?php
-                               if ($cc = (isset($user->geoip->country_code)) ? strtolower($user->geoip->country_code) : "")
+                               if (strlen($cc))
                                {
                                   ?>  <img src="https://flagcdn.com/48x36/<?php echo htmlspecialchars($cc); ?>.png"
                                                        width="20"
@@ -46,6 +51,9 @@ function generate_html_whois($user)
                                        <a href="<?php echo htmlspecialchars(get_config("base_url")."tools/ip-whois.php?ip=$user->ip"); ?>"><button class="btn-sm btn-primary">WHOIS IP</button></a>
                                </td>
                                <td><button id="ipnotes" class="btn btn-sm btn-secondary fa-solid fa-sticky-note text-nowrap"> <?php echo $numnotes['ip']?></button></td>
+                       </tr><tr>
+                               <th>ASN</th>
+                               <td colspan="2"><code><?php echo "$asname ($asn)"; ?></code></td>
                        </tr><tr>
                                <th>Ident</th>
                                <td colspan="2"><code><?php echo htmlspecialchars($user->user->username); ?></code></td>