diff --git a/src/server/cyberhex-code/install/create_db.php b/src/server/cyberhex-code/install/create_db.php
index 1a1e63f..f8f319b 100644
--- a/src/server/cyberhex-code/install/create_db.php
+++ b/src/server/cyberhex-code/install/create_db.php
@@ -20,169 +20,169 @@
-
- connect_error) {
- $success=0;
- die("Connection failed: " . $conn->connect_error);
- }
+ // Check connection
+ if ($conn->connect_error) {
+ $success=0;
+ die("Connection failed: " . $conn->connect_error);
+ }
- // Create database
- $sql = "CREATE DATABASE IF NOT EXISTS $DB_DATABASE";
- if ($conn->query($sql) === TRUE) {
- echo '
- Database created successfully!
+ // Create database
+ $sql = "CREATE DATABASE IF NOT EXISTS $DB_DATABASE";
+ if ($conn->query($sql) === TRUE) {
+ echo '
+ Database created successfully!
+
';
+ } else {
+ $success=0;
+ echo '
+ Error creating database: ' . $conn->error .'
';
- } else {
- $success=0;
- echo '
- Error creating database: ' . $conn->error .'
-
';
- }
+ }
- $conn->close();
+ $conn->close();
- // Connect to the new database
- $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD,$DB_DATABASE);
+ // Connect to the new database
+ $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD,$DB_DATABASE);
- // Check connection
- if ($conn->connect_error) {
- $success=0;
- die("Connection failed: " . $conn->connect_error);
- }
+ // Check connection
+ if ($conn->connect_error) {
+ $success=0;
+ die("Connection failed: " . $conn->connect_error);
+ }
- // Create user table
- $sql = "CREATE TABLE IF NOT EXISTS users (
- id INT AUTO_INCREMENT PRIMARY KEY,
- username VARCHAR(255) NOT NULL,
- email VARCHAR(255) NOT NULL,
- perms VARCHAR(255),
- password VARCHAR(255),
- 2fa VARCHAR(255)
- )";
+ // Create user table
+ $sql = "CREATE TABLE IF NOT EXISTS users (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ username VARCHAR(255) NOT NULL,
+ email VARCHAR(255) NOT NULL,
+ perms VARCHAR(255),
+ password VARCHAR(255),
+ 2fa VARCHAR(255)
+ )";
- if ($conn->query($sql) === TRUE) {
- echo '
- Table users created successfully!
-
';
- } else {
- $success=0;
- echo '
- Error creating table users: ' . $conn->error .'
-
';
- }
-
- // Create log table
- $sql = "CREATE TABLE IF NOT EXISTS log (
- id INT AUTO_INCREMENT PRIMARY KEY,
- logtext VARCHAR(255) NOT NULL,
- loglevel VARCHAR(255) NOT NULL,
- machine_id VARCHAR(255)
- )";
-
- if ($conn->query($sql) === TRUE) {
+ if ($conn->query($sql) === TRUE) {
echo '
- Table log created successfully!
-
';
- } else {
- $success=0;
+ Table users created successfully!
+
';
+ } else {
+ $success=0;
echo '
- Error creating table log: ' . $conn->error .'
-
';
- }
+ Error creating table users: ' . $conn->error .'
+ ';
+ }
- // Create settings table
- $sql = "CREATE TABLE IF NOT EXISTS settings (
- id INT AUTO_INCREMENT PRIMARY KEY,
- name VARCHAR(255) NOT NULL,
- value VARCHAR(255) NOT NULL
- )";
+ // Create log table
+ $sql = "CREATE TABLE IF NOT EXISTS log (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ logtext VARCHAR(255) NOT NULL,
+ loglevel VARCHAR(255) NOT NULL,
+ machine_id VARCHAR(255)
+ )";
- if ($conn->query($sql) === TRUE) {
+ if ($conn->query($sql) === TRUE) {
+ echo '
+ Table log created successfully!
+
';
+ } else {
+ $success=0;
+ echo '
+ Error creating table log: ' . $conn->error .'
+
';
+ }
+
+ // Create settings table
+ $sql = "CREATE TABLE IF NOT EXISTS settings (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ name VARCHAR(255) NOT NULL,
+ value VARCHAR(255) NOT NULL
+ )";
+
+ if ($conn->query($sql) === TRUE) {
+ echo '
+ Table settings created successfully!
+
';
+ } else {
+ $success=0;
+ echo '
+ Error creating table settings: ' . $conn->error .'
+
';
+ }
+
+ // Create api table
+ $sql = "CREATE TABLE IF NOT EXISTS api (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ apikey VARCHAR(255) NOT NULL,
+ machine_id VARCHAR(255) NOT NULL
+ )";
+
+ if ($conn->query($sql) === TRUE) {
+ echo '
+ Table api created successfully!
+
';
+ } else {
+ $success=0;
+ echo '
+ Error creating table api: ' . $conn->error .'
+
';
+ }
+
+ // Create secrets table
+ $sql = "CREATE TABLE IF NOT EXISTS secrets (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ cert VARCHAR(255) NOT NULL,
+ machine_id VARCHAR(255) NOT NULL
+ )";
+
+ if ($conn->query($sql) === TRUE) {
+ echo '
+ Table secrets created successfully!
+
';
+ } else {
+ $success=0;
+ echo '
+ Error creating table secrets: ' . $conn->error .'
+
';
+ }
+
+ // Create machine table
+ $sql = "CREATE TABLE IF NOT EXISTS machines (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ machine_name VARCHAR(255) NOT NULL,
+ machine_location VARCHAR(255) NOT NULL,
+ machine_ip VARCHAR(255) NOT NULL
+ )";
+
+ if ($conn->query($sql) === TRUE) {
+ echo '
+ Table machines created successfully!
+
';
+ } else {
+ $success=0;
+ echo '
+ Error creating table machines: ' . $conn->error .'
+
';
+ }
+
+ if($success!==1){
+ echo '
+ There was an error creating the databases. Please try again or contact support at:
info.jakach@gmail.com
+
';
+ }else{
echo '
- Table settings created successfully!
-
';
- } else {
- $success=0;
- echo '
- Error creating table settings: ' . $conn->error .'
-
';
- }
+ Database created successfully! Continue installation
+ ';
+ }
- // Create api table
- $sql = "CREATE TABLE IF NOT EXISTS api (
- id INT AUTO_INCREMENT PRIMARY KEY,
- apikey VARCHAR(255) NOT NULL,
- machine_id VARCHAR(255) NOT NULL
- )";
-
- if ($conn->query($sql) === TRUE) {
- echo '
- Table api created successfully!
-
';
- } else {
- $success=0;
- echo '
- Error creating table api: ' . $conn->error .'
-
';
- }
-
- // Create secrets table
- $sql = "CREATE TABLE IF NOT EXISTS secrets (
- id INT AUTO_INCREMENT PRIMARY KEY,
- cert VARCHAR(255) NOT NULL,
- machine_id VARCHAR(255) NOT NULL
- )";
-
- if ($conn->query($sql) === TRUE) {
- echo '
- Table secrets created successfully!
-
';
- } else {
- $success=0;
- echo '
- Error creating table secrets: ' . $conn->error .'
-
';
- }
-
- // Create machine table
- $sql = "CREATE TABLE IF NOT EXISTS machines (
- id INT AUTO_INCREMENT PRIMARY KEY,
- machine_name VARCHAR(255) NOT NULL,
- machine_location VARCHAR(255) NOT NULL,
- machine_ip VARCHAR(255) NOT NULL
- )";
-
- if ($conn->query($sql) === TRUE) {
- echo '
- Table machines created successfully!
-
';
- } else {
- $success=0;
- echo '
- Error creating table machines: ' . $conn->error .'
-
';
- }
-
- if($success!==1){
- echo '
- There was an error creating the databases. Please try again or contact support at:
info.jakach@gmail.com
-
';
- }else{
- echo '
';
- }
-
- $conn->close();
- ?>
+ $conn->close();
+ ?>
+