fixing bugs
This commit is contained in:
@@ -85,369 +85,6 @@
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create log table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS log (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
logtext VARCHAR(500) NOT NULL,
|
||||
loglevel VARCHAR(255) NOT NULL,
|
||||
machine_id VARCHAR(255),
|
||||
time VARCHAR(255)
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table log created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table log: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create incident table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS incidents (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
status VARCHAR(50) NOT NULL,
|
||||
description VARCHAR(255) NOT NULL,
|
||||
opened VARCHAR(50),
|
||||
closed VARCHAR(50)
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table incidents created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table incidents: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create todo_items table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS todo_items (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
done INT,
|
||||
done_by INT,
|
||||
belongs_to_list INT,
|
||||
text VARCHAR(500) NOT NULL
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table todo_items created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table todo_items: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create todo lists table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS todo_lists (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
belongs_to_incident INT,
|
||||
name VARCHAR(255) NOT NULL
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table todo_items created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table todo_items: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create chat table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS chats (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
belongs_to_incident INT,
|
||||
text TEXT NOT NULL,
|
||||
sent VARCHAR(50),
|
||||
from_userid INT
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table todo_items created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table todo_items: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
// Create server log table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS server_log (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
logtext VARCHAR(500) NOT NULL,
|
||||
loglevel VARCHAR(255) NOT NULL,
|
||||
userid INT,
|
||||
time VARCHAR(255)
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table log created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table log: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create settings table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS settings (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL UNIQUE,
|
||||
value VARCHAR(255) NOT NULL
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table settings created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table settings: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
//user tasks table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS user_tasks (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
task VARCHAR(255) NOT NULL UNIQUE
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table settings created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table settings: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
//system tasks table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS system_tasks (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
task VARCHAR(255) NOT NULL UNIQUE
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table settings created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table settings: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
// Create rtp_included table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS rtp_included (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
path VARCHAR(255) NOT NULL UNIQUE
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table rtp_included created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table rtp_included: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
// Create rtp_excluded table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS rtp_excluded (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
path VARCHAR(255) NOT NULL UNIQUE
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table rtp_excluded created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table rtp_excluded: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create dissalowed_start table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS disallowed_start (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
path VARCHAR(255) NOT NULL UNIQUE
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table disalowed_start created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table disalowed_start: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create api table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS api (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
apikey VARCHAR(500) NOT NULL,
|
||||
machine_id VARCHAR(255) NOT NULL
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table api created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table api: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create secrets table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS secrets (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
cert VARCHAR(500) NOT NULL,
|
||||
machine_id VARCHAR(255) NOT NULL
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table secrets created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table secrets: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// 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 '<br><div class="alert alert-success" role="alert">
|
||||
Table machines created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table machines: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create vir_notify messages table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS vir_notify (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
machine_id VARCHAR(255) NOT NULL,
|
||||
path VARCHAR(255) NOT NULL,
|
||||
hash VARCHAR(255) NOT NULL,
|
||||
action VARCHAR(255) NOT NULL
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table machines created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table machines: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create sig_ex messages table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS sig_ex (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
signature VARCHAR(255) NOT NULL,
|
||||
description VARCHAR(255) NOT NULL
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table excluded signatures created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table excluded signatures: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Create sig_in messages table
|
||||
$sql = "CREATE TABLE IF NOT EXISTS sig_in (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
signature VARCHAR(255) NOT NULL,
|
||||
description VARCHAR(255) NOT NULL
|
||||
)";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Table included signatures created successfully!
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating table included signatures: ' . $conn->error .'
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Attempt to create the directory where export files will be stored later on
|
||||
/*if (mkdir("/var/www/html/export", 0777, true)) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Created export dir successfully.
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating export dir.
|
||||
</div>';
|
||||
}
|
||||
//Attempt to create the directory where import files will be stored later on
|
||||
if (mkdir("/var/www/html/import", 0777, true)) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Created export dir successfully.
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating export dir.
|
||||
</div>';
|
||||
}
|
||||
|
||||
//Attempt to create the directory where log backup files will be stored later on
|
||||
if (mkdir("/var/www/html/backup", 0777, true)) {
|
||||
echo '<br><div class="alert alert-success" role="alert">
|
||||
Created backup dir successfully.
|
||||
</div>';
|
||||
} else {
|
||||
$success=0;
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
Error creating backup dir.
|
||||
</div>';
|
||||
}*/
|
||||
|
||||
if($success!==1){
|
||||
echo '<br><div class="alert alert-danger" role="alert">
|
||||
|
||||
Reference in New Issue
Block a user