]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame - plugins/sql_auth/sql_auth.php
Add SQL config items to config sample
[irc/unrealircd/unrealircd-webpanel.git] / plugins / sql_auth / sql_auth.php
CommitLineData
ea27475b
VP
1<?php
2
3require_once "SQL/sql.php";
4class sql_auth
5{
6 public $name = "SQL_Auth";
7 public $author = "Valware";
8 public $version = "1.0";
9 public $description = "Provides a User Auth and Management Panel with an SQL backend";
10
11 function __construct()
12 {
13 Hook::func(HOOKTYPE_NAVBAR, 'sql_auth::add_navbar');
14 }
15
16 public static function add_navbar(&$pages)
17 {
18 $query = "SELECT * FROM INFORMATION_SCHEMA.TABLES
19 WHERE TABLE_TYPE = 'BASE TABLE'
20 AND TABLE_NAME = '".SQL_PREFIX."users'";
21
22 $conn = sqlnew();
23 $result = $conn->query($query);
24 $notifs = 0;
25 if (!$result || !$result->fetchColumn())
26 {
27 ++$notifs;
28 $link = "error.php?errno=1";
29 }
30 $label = ($notifs) ? "<span class=\"position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger\">$notifs</span>" : "";
31 $pages["SQL Auth$label"] = "plugins/sql_auth/$link";
32 }
33
34
35}