+ else
+ {
+ $user = new SQLA_User(NULL, $_SESSION['id']);
+ if (!$user->id)
+ {
+ session_destroy();
+ header("Location: ".BASE_URL."plugins/sql_auth/login.php");
+ }
+ }
+ }
+
+ public static function create_tables()
+ {
+ $conn = sqlnew();
+ $conn->query("CREATE TABLE IF NOT EXISTS " . SQL_PREFIX . "users (
+ user_id int AUTO_INCREMENT NOT NULL,
+ user_name VARCHAR(255) NOT NULL,
+ user_pass VARCHAR(255) NOT NULL,
+
+ user_fname VARCHAR(255),
+ user_lname VARCHAR(255),
+ user_bio VARCHAR(255),
+ created VARCHAR(255),
+ PRIMARY KEY (user_id)
+ )");
+ $conn->query("CREATE TABLE IF NOT EXISTS " . SQL_PREFIX . "user_meta (
+ meta_id int AUTO_INCREMENT NOT NULL,
+ user_id int NOT NULL,
+ meta_key VARCHAR(255) NOT NULL,
+ meta_value VARCHAR(255),
+ PRIMARY KEY (meta_id)
+ )");
+ }
+
+ public static function add_overview_card(&$stats)
+ {
+ $num_of_panel_admins = sqlnew()->query("SELECT COUNT(*) FROM " . SQL_PREFIX . "users")->fetchColumn();
+ ?>
+
+ <div class="container mt-5">
+
+ <div class="row">
+ <div class="col-sm-3">
+ <div class="card text-center">
+ <div class="card-header bg-success text-white">
+ <div class="row">
+ <div class="col">
+ <i class="fa fa-lock-open fa-3x"></i>
+ </div>
+ <div class="col">
+ <h3 class="display-4"><?php echo $num_of_panel_admins; ?></h3>
+ </div>
+ </div>
+ </div>
+ <div class="card-body">
+ <div class="row">
+ <div class="col">
+ <h6>Panel Users</h6>
+ </div>
+ <div class="col"> <a class="btn btn-primary" href="<?php echo BASE_URL; ?>plugins/sql_auth/">View</a></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <?php