3 die("WORK IN PROGRESS: This setup is being recoded to an all in one 'online install screen'. Try a 'git pull' tomorrow, maybe then the new setup is working.");
5 require_once "../../common.php";
10 <div
class="media-body">
12 <meta name
="viewport" content
="width=device-width, initial-scale=1">
13 <meta name
="HandheldFriendly" content
="true">
15 <link href
="<?php echo get_config("base_url
"); ?>css/unrealircd-admin.css" rel
="stylesheet">
18 <!-- Latest compiled
and minified CSS
-->
19 <link rel
="stylesheet" href
="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
21 <!-- Font Awesome JS
-->
22 <script defer src
="https://use.fontawesome.com/releases/v6.2.1/js/solid.js" integrity
="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin
="anonymous"></script
>
23 <script defer src
="https://use.fontawesome.com/releases/v6.2.1/js/fontawesome.js" integrity
="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin
="anonymous"></script
>
25 <!-- Font Awesome icons
-->
26 <link rel
="stylesheet" href
="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
27 <script src
="<?php echo get_config("base_url
"); ?>js/unrealircd-admin.js"></script
>
28 <title
>UnrealIRCd Panel
</title
>
29 <link rel
="icon" type
="image/x-icon" href
="<?php echo get_config("base_url
"); ?>img/favicon.ico">
31 <body role
="document">
33 <script src
="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity
="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin
="anonymous"></script
>
35 <script src
="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity
="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin
="anonymous"></script
>
37 <script src
="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity
="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin
="anonymous"></script
>
41 if (!isset($_POST) || empty($_POST))
44 <div
class="container">
46 In order to
use SQL Auth
, the relevant SQL tables must be created
.<br
>
47 If, for some reason
, that
's not what you want, please remove <code>"sql_auth"</code> from the plugins option in your webpanel configuration.<br><br>
48 Thanks for using SQL Auth plugin!<br><br>
51 <button id="createbtn" name="createbtn" class="btn btn-primary" type="submit">Create the tables!</button>
56 elseif (isset($_POST['createbtn
']))
59 $conn->query("CREATE TABLE IF NOT EXISTS " . get_config("mysql::table_prefix") . "users (
60 user_id int AUTO_INCREMENT NOT NULL,
61 user_name VARCHAR(255) NOT NULL,
62 user_pass VARCHAR(255) NOT NULL,
63 user_email VARCHAR(255),
64 user_fname VARCHAR(255),
65 user_lname VARCHAR(255),
66 user_bio VARCHAR(255),
72 * Patch for beta users
73 * This adds the email column to existing tables without it
75 $columns = $conn->query("SHOW COLUMNS FROM " . get_config("mysql::table_prefix") . "users");
76 $column_names = array();
77 $c = $columns->fetchAll();
79 foreach($c as $column) {
80 $column_names[] = $column['Field
'];
82 $column_exists = in_array("user_email", $column_names);
83 if (!$column_exists) {
84 $conn->query("ALTER TABLE " . get_config("mysql::table_prefix") . "users ADD COLUMN user_email varchar(255)");
88 * Another patch for beta users
89 * This changes the size of the meta_value so we can store more
92 $conn->query("CREATE TABLE IF NOT EXISTS " . get_config("mysql::table_prefix") . "user_meta (
93 meta_id int AUTO_INCREMENT NOT NULL,
95 meta_key VARCHAR(255) NOT NULL,
96 meta_value VARCHAR(255),
99 $conn->query("CREATE TABLE IF NOT EXISTS " . get_config("mysql::table_prefix") . "auth_settings (
100 id int AUTO_INCREMENT NOT NULL,
101 setting_key VARCHAR(255) NOT NULL,
102 setting_value VARCHAR(255),
105 $conn->query("CREATE TABLE IF NOT EXISTS " . get_config("mysql::table_prefix") . "fail2ban (
106 id int AUTO_INCREMENT NOT NULL,
107 ip VARCHAR(255) NOT NULL,
112 if (($columns = $conn->query("SHOW COLUMNS FROM ".get_config("mysql::table_prefix")."user_meta")));
113 $c = $columns->fetchAll();
115 $conn->query("ALTER TABLE `".get_config("mysql::table_prefix")."user_meta` CHANGE `meta_value` `meta_value` VARCHAR(5000) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL");
121 /* make sure everything went well */
122 $tables = ["users", "user_meta", "fail2ban", "auth_settings"];
123 $errors = 0; // counter
124 $error_messages = "";
125 foreach($tables as $table)
127 $prefix = get_config("sql::table_prefix");
128 $sql = "SHOW TABLES LIKE '$prefix%
'"; // SQL query to check if table exists
130 $result = $conn->query($sql);
131 if ($result->rowCount())
136 strcat($error_messages,"Table '$prefix$table' was not created successfully
.<br
>");
141 if (defined('DEFAULT_USER')) // we've got a default account
143 $lkup = new PanelUser(DEFAULT_USER['username']);
145 if (!$lkup->id) // doesn't exist, add it with full privileges
148 $user['user_name'] = DEFAULT_USER['username'];
149 $user['user_pass'] = DEFAULT_USER['password'];
151 create_new_user($user);
153 $lkup = new PanelUser(DEFAULT_USER['username']);
154 if (!user_can($lkup, PERMISSION_MANAGE_USERS))
155 $lkup->add_permission(PERMISSION_MANAGE_USERS);
157 Message::Success("Congratulations
, you
're all ready to go!");
160 Message::Fail("An error was encountered:", $error_messages);
163 <a class="btn btn-primary" href="<?php echo get_config("base_url"); ?>">Take me home!</a>
164 <a class="btn btn-warning" href="<?php echo get_config("base_url")."settings"; ?>">Settings</a>
167 require_once "../../footer.php";