Browse Source

Completed basic functionnality for WebPage

3ndur4nce 3 years ago
parent
commit
a4d9e51c39

+ 37 - 0
WebPage/.htaccess

@@ -0,0 +1,37 @@
+
+# php -- BEGIN cPanel-generated handler, do not edit
+# Set the “alt-php80” package as the default “PHP” programming language.
+<IfModule mime_module>
+  AddHandler application/x-httpd-alt-php80___lsphp .php .php8 .phtml
+</IfModule>
+# php -- END cPanel-generated handler, do not edit
+
+# BEGIN cPanel-generated php ini directives, do not edit
+# Manual editing of this file may result in unexpected behavior.
+# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
+# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
+<IfModule php8_module>
+   php_flag display_errors On
+   php_value max_execution_time 30
+   php_value max_input_time 60
+   php_value max_input_vars 1000
+   php_value memory_limit 128M
+   php_value post_max_size 128M
+   php_value session.gc_maxlifetime 1440
+   php_value session.save_path "/opt/alt/php80/var/lib/php/session"
+   php_value upload_max_filesize 2M
+   php_flag zlib.output_compression Off
+</IfModule>
+<IfModule lsapi_module>
+   php_flag display_errors On
+   php_value max_execution_time 30
+   php_value max_input_time 60
+   php_value max_input_vars 1000
+   php_value memory_limit 128M
+   php_value post_max_size 128M
+   php_value session.gc_maxlifetime 1440
+   php_value session.save_path "/opt/alt/php80/var/lib/php/session"
+   php_value upload_max_filesize 2M
+   php_flag zlib.output_compression Off
+</IfModule>
+# END cPanel-generated php ini directives, do not edit

+ 15 - 0
WebPage/.user.ini

@@ -0,0 +1,15 @@
+; cPanel-generated php ini directives, do not edit
+; Manual editing of this file may result in unexpected behavior.
+; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
+; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
+
+display_errors = On
+max_execution_time = 30
+max_input_time = 60
+max_input_vars = 1000
+memory_limit = 128M
+post_max_size = 128M
+session.gc_maxlifetime = 1440
+session.save_path = "/opt/alt/php80/var/lib/php/session"
+upload_max_filesize = 2M
+zlib.output_compression = Off

+ 0 - 123
WebPage/api/v1.php

@@ -1,123 +0,0 @@
-<?php
-define('DB_SERVER', 'dbhost');
-define('DB_USERNAME', 'dbuser');
-define('DB_PASSWORD', 'dbpasswd');
-define('DB_NAME', 'dbname');
-
-
-$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
-
-if (!$link->set_charset("utf8")) {
-    printf("Error loading character set utf8: %s\n", $link->error);
-} 
-if($link === false){
-    die("ERROR: Could not connect. " . mysqli_connect_error());
-}
-
-if(isset($_GET['a'])){
-    $a = $_GET['a'];
-}
-if(isset($_GET['srvnm'])){
-    $srvnm = trim($_GET['srvnm']);
-}
-if(isset($_GET['usrnm'])){
-    $usrnm = trim($_GET['usrnm']);
-}
-if(isset($_GET['pwd'])){
-    $pwd = trim($_GET['pwd']);
-}
-if(isset($_GET['sct'])){
-    $sct = trim($_GET['sct']);
-}
-if(isset($_GET['technm'])){
-    $technm = trim($_GET['technm']);
-}
-if(isset($_GET['kee'])){
-    $kee = trim($_GET['kee']);
-}
-if(isset($_GET['scrpt'])){
-    $scrpt = trim($_GET['scrpt']);
-}
-
-$getreqqry = mysqli_query($link, "SELECT * from request where servername = '$usrnm' AND passwd = '$pwd'");
-while($row = mysqli_fetch_array($getreqqry)){
-  $reqid = $row['id'];
-}
-
-if($a == "reqacc" & $kee == "alsdjhfawer34667847694742456sgdfgraereajek"){
-    $instreq = "INSERT into request (tech, servername, passwd) values (?, ?, ?)";
-    if($stmt = mysqli_prepare($link, $instreq)){
-        mysqli_stmt_bind_param($stmt, "sss", $technm, $usrnm, $pwd);
-        if(mysqli_stmt_execute($stmt)){
-            echo 1;
-        }else{
-            echo "noreqacc";
-        }
-    }
-}
-if($a == "accdoi" & $kee == "alsdjhfawer34667847694742456sgdfgraereajek"){
-    $getreqqry = mysqli_query($link, "SELECT * from request where servername = '$usrnm' AND passwd = '$pwd'");
-    while($row = mysqli_fetch_array($getreqqry)){
-        echo $row['approved'];
-    }
-}
-if($a == "addentry" & $reqid != ""){
-    $getrepqry = mysqli_query($link, "SELECT EXISTS(SELECT * from repports where reqid = '$reqid' AND server_name = '$srvnm')");
-    while($row = mysqli_fetch_array($getrepqry)){
-        $repext = $row[0];
-    }
-    if($repext == 1){
-        $getrepqry = mysqli_query($link, "SELECT * from repports where reqid = '$reqid' AND server_name = '$srvnm'");
-        while($row = mysqli_fetch_array($getrepqry)){
-            $repid = $row['id'];
-            $cltid = $row['client_id'];
-        }
-    }else{
-        $instrep = "INSERT into repports (reqid, server_name, devicetype) values (?, ?, ?)";
-        if($stmt = mysqli_prepare($link, $instrep)){
-            $devicetype = 1;
-            mysqli_stmt_bind_param($stmt, "isi", $reqid, $srvnm, $devicetype);
-            if(mysqli_stmt_execute($stmt)){
-            }else{
-            }
-        }
-        $getrepqry = mysqli_query($link, "SELECT * from repports where reqid = '$reqid' AND server_name = '$srvnm'");
-        while($row = mysqli_fetch_array($getrepqry)){
-            $repid = $row['id'];
-            $cltid = $row['client_id'];
-        }
-    }
-
-    $data = explode(',', $_POST["data"]);
-    $data1 = $data[0];
-    $data2 = $data[1];
-    $data3 = $data[2];
-    $data4 = $data[3];
-    $data5 = $data[4];
-    $data6 = $data[5];
-    $data7 = $data[6];
-
-    $instentry = "INSERT into entries (repportid, servername, section, data1, data2, data3, data4, data5, data6, data7) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
-    if($stmt = mysqli_prepare($link, $instentry)){
-        mysqli_stmt_bind_param($stmt, "isssssssss", $repid, $srvnm, $sct, $data1, $data2, $data3, $data4, $data5, $data6, $data7);
-        if(mysqli_stmt_execute($stmt)){
-            echo 1;
-        }else{
-            echo "noinsertentry";
-        }
-    }
-}
-if($a == "getscript" & $reqid != ""){
-    if($scrpt == "start"){
-        $script = file_get_contents("/home/maintenance/repo/dev/startup");
-        $myfile = fopen("/home/maintenance/repo/dev/startup", "r") or die("Unable to open file!");
-        echo fread($myfile,filesize("/home/maintenance/repo/dev/startup"));
-        fclose($myfile);
-    }elseif($scrpt == "mod"){
-        $script = file_get_contents("/home/maintenance/repo/dev/modules");
-        $myfile = fopen("/home/maintenance/repo/dev/modules", "r") or die("Unable to open file!");
-        echo fread($myfile,filesize("/home/maintenance/repo/dev/modules"));
-        fclose($myfile);
-    }
-}
-?>

+ 2 - 2
WebPage/config.php

@@ -1,9 +1,9 @@
 <?php
 
-define('DB_SERVER', 'host');
+define('DB_SERVER', 'localhost');
 define('DB_USERNAME', 'user');
 define('DB_PASSWORD', 'pass');
-define('DB_NAME', 'srm');
+define('DB_NAME', 'db');
 
 
 $link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

+ 53 - 0
WebPage/error_log

@@ -0,0 +1,53 @@
+[04-Nov-2022 16:05:35 UTC] PHP Notice:  session_start(): Ignoring session_start() because a session is already active in /home/endurcom/rmm.endur4.com/place/login.php on line 47
+[04-Nov-2022 16:05:36 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 58
+[04-Nov-2022 16:05:36 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:05:36 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/theme.php on line 36
+[04-Nov-2022 16:05:36 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/theme.php on line 38
+[04-Nov-2022 16:05:36 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/theme.php on line 40
+[04-Nov-2022 16:05:36 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/theme.php on line 42
+[04-Nov-2022 16:05:39 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:05:39 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:05:40 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:05:41 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:05:44 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:05:46 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:06:41 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:08:37 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:08:38 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:08:39 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:08:41 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:09:23 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:09:25 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:09:25 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:09:28 UTC] PHP Warning:  Undefined variable $rep in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 144
+[04-Nov-2022 16:12:06 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/place/assets.php:31
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/place/assets.php(31): mysqli_fetch_array()
+#1 /home/endurcom/rmm.endur4.com/place/theme.php(37): require('/home/endurcom/...')
+#2 /home/endurcom/rmm.endur4.com/place/getvalues.php(144): require('/home/endurcom/...')
+#3 /home/endurcom/rmm.endur4.com/index.php(9): require('/home/endurcom/...')
+#4 {main}
+  thrown in /home/endurcom/rmm.endur4.com/place/assets.php on line 31
+[04-Nov-2022 16:12:46 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/place/assets.php:31
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/place/assets.php(31): mysqli_fetch_array()
+#1 /home/endurcom/rmm.endur4.com/place/theme.php(37): require('/home/endurcom/...')
+#2 /home/endurcom/rmm.endur4.com/place/getvalues.php(144): require('/home/endurcom/...')
+#3 /home/endurcom/rmm.endur4.com/index.php(9): require('/home/endurcom/...')
+#4 {main}
+  thrown in /home/endurcom/rmm.endur4.com/place/assets.php on line 31
+[04-Nov-2022 19:49:49 UTC] PHP Notice:  session_start(): Ignoring session_start() because a session is already active in /home/endurcom/rmm.endur4.com/place/login.php on line 47
+[04-Nov-2022 19:49:49 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/getvalues.php on line 59
+[04-Nov-2022 19:49:49 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/theme.php on line 36
+[04-Nov-2022 19:49:49 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/theme.php on line 38
+[04-Nov-2022 19:49:49 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/theme.php on line 40
+[04-Nov-2022 19:49:49 UTC] PHP Warning:  Undefined variable $place in /home/endurcom/rmm.endur4.com/place/theme.php on line 42
+[04-Nov-2022 20:23:20 UTC] PHP Warning:  Undefined variable $schedid in /home/endurcom/rmm.endur4.com/place/assets.php on line 43
+[04-Nov-2022 20:23:20 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/place/assets.php:44
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/place/assets.php(44): mysqli_fetch_array()
+#1 /home/endurcom/rmm.endur4.com/place/theme.php(37): require('/home/endurcom/...')
+#2 /home/endurcom/rmm.endur4.com/place/getvalues.php(145): require('/home/endurcom/...')
+#3 /home/endurcom/rmm.endur4.com/index.php(9): require('/home/endurcom/...')
+#4 {main}
+  thrown in /home/endurcom/rmm.endur4.com/place/assets.php on line 44

+ 45 - 0
WebPage/images/U-MAAS.png


+ 85 - 0
WebPage/inform/poll/error_log

@@ -0,0 +1,85 @@
+[04-Nov-2022 19:18:14 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/inform/poll/index.php:15
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/inform/poll/index.php(15): mysqli_fetch_array()
+#1 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 15
+[04-Nov-2022 19:18:37 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/inform/poll/index.php:15
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/inform/poll/index.php(15): mysqli_fetch_array()
+#1 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 15
+[04-Nov-2022 19:18:56 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/inform/poll/index.php:23
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/inform/poll/index.php(23): mysqli_fetch_array()
+#1 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 23
+[04-Nov-2022 19:19:16 UTC] PHP Warning:  Undefined variable $halfdayago in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 30
+[04-Nov-2022 19:19:16 UTC] PHP Fatal error:  Uncaught Error: Call to a member function sub() on null in /home/endurcom/rmm.endur4.com/inform/poll/index.php:30
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 30
+[04-Nov-2022 19:19:48 UTC] PHP Fatal error:  Uncaught Error: Object of class DateTime could not be converted to string in /home/endurcom/rmm.endur4.com/inform/poll/index.php:32
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 32
+[04-Nov-2022 19:20:37 UTC] PHP Fatal error:  Uncaught TypeError: strlen(): Argument #1 ($str) must be of type string, DateTime given in /home/endurcom/rmm.endur4.com/inform/poll/index.php:28
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 28
+[04-Nov-2022 19:21:33 UTC] PHP Fatal error:  Uncaught TypeError: strlen(): Argument #1 ($str) must be of type string, DateTime given in /home/endurcom/rmm.endur4.com/inform/poll/index.php:29
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 29
+[04-Nov-2022 19:21:59 UTC] PHP Parse error:  syntax error, unexpected token "echo" in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 29
+[04-Nov-2022 19:22:10 UTC] PHP Parse error:  syntax error, unexpected token "echo" in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 29
+[04-Nov-2022 19:22:56 UTC] PHP Fatal error:  Uncaught Error: Object of class DateTime could not be converted to string in /home/endurcom/rmm.endur4.com/inform/poll/index.php:33
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 33
+[04-Nov-2022 19:26:04 UTC] PHP Fatal error:  Uncaught Error: Object of class DateTime could not be converted to string in /home/endurcom/rmm.endur4.com/inform/poll/index.php:34
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 34
+[04-Nov-2022 19:26:37 UTC] PHP Fatal error:  Uncaught Error: Object of class DateTime could not be converted to string in /home/endurcom/rmm.endur4.com/inform/poll/index.php:34
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 34
+[04-Nov-2022 19:26:50 UTC] PHP Fatal error:  Uncaught Error: Object of class DateTime could not be converted to string in /home/endurcom/rmm.endur4.com/inform/poll/index.php:33
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 33
+[04-Nov-2022 19:27:09 UTC] PHP Fatal error:  Uncaught Error: Object of class DateTime could not be converted to string in /home/endurcom/rmm.endur4.com/inform/poll/index.php:33
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 33
+[04-Nov-2022 19:27:32 UTC] PHP Fatal error:  Uncaught Error: Object of class DateTime could not be converted to string in /home/endurcom/rmm.endur4.com/inform/poll/index.php:33
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 33
+[04-Nov-2022 19:28:52 UTC] PHP Fatal error:  Uncaught Error: Object of class DateTime could not be converted to string in /home/endurcom/rmm.endur4.com/inform/poll/index.php:34
+Stack trace:
+#0 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 34
+[04-Nov-2022 19:32:25 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/inform/poll/index.php:40
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/inform/poll/index.php(40): mysqli_fetch_array()
+#1 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 40
+[04-Nov-2022 19:34:22 UTC] PHP Warning:  Undefined variable $scriptid in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 38
+[04-Nov-2022 19:35:03 UTC] PHP Parse error:  syntax error, unexpected token ";", expecting ")" in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 38
+[04-Nov-2022 19:42:21 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/inform/poll/index.php:35
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/inform/poll/index.php(35): mysqli_fetch_array()
+#1 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 35
+[04-Nov-2022 19:43:22 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/inform/poll/index.php:35
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/inform/poll/index.php(35): mysqli_fetch_array()
+#1 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 35
+[04-Nov-2022 19:51:19 UTC] PHP Fatal error:  Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in /home/endurcom/rmm.endur4.com/inform/poll/index.php:35
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/inform/poll/index.php(35): mysqli_fetch_array()
+#1 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 35
+[04-Nov-2022 20:00:30 UTC] PHP Warning:  Undefined array key "schedid" in /home/endurcom/rmm.endur4.com/inform/poll/index.php on line 37

+ 44 - 0
WebPage/inform/poll/index.php

@@ -0,0 +1,44 @@
+<?php
+
+require_once "../../config.php";
+
+if(isset($_GET['do'])){
+    $do = $_GET['do'];
+}
+if(isset($_GET['hostname'])){
+    $hostname = $_GET['hostname'];
+}
+
+$authorisationheader = getallheaders()['Authorization'];
+
+$getauthqry = mysqli_query($link, "SELECT 1 FROM assets WHERE token = '$authorisationheader' AND name = '$hostname' LIMIT 1");
+while($row = mysqli_fetch_array($getauthqry)){
+    if($row['1'] == '1'){
+        $auth = 'ok';
+    }
+}
+
+if($auth == 'ok'){
+    $getassetqry = mysqli_query($link, "SELECT * FROM assets WHERE token = '$authorisationheader' AND name = '$hostname'");
+    while($row = mysqli_fetch_array($getassetqry)){
+        $assetid = $row['id'];
+        $active = $row['active'];
+    }
+    if($active == 1){
+        $date = new \DateTime();
+        $datenow = $date->format("Y-m-d H:i:s");
+        $date = new DateTime();
+        $tosub = new DateInterval('PT12H00M');
+        $halfdayago = $date->sub($tosub);
+        $datehalfdayago = $date->format("Y-m-d H:i:s");
+        $getschedqry = mysqli_query($link, "SELECT * FROM schedules WHERE assetid = $assetid AND runtime <= '$datenow' AND runtime >= '$datehalfdayago' AND rantime IS NULL ORDER BY runtime ASC LIMIT 1");
+        while($row = mysqli_fetch_array($getschedqry)){
+            $schedid = $row['id'];
+        }
+        if(isset($schedid)){
+            echo "$schedid";
+        }else{
+            echo 0;
+        }
+    }
+}

+ 46 - 0
WebPage/inform/register/index.php

@@ -0,0 +1,46 @@
+<?php
+
+require_once "../../config.php";
+
+if(isset($_GET['do'])){
+    $do = $_GET['do'];
+}
+if(isset($_GET['hostname'])){
+    $hostname = $_GET['hostname'];
+}
+
+$authorisationheader = getallheaders()['Authorization'];
+
+$getauthqry = mysqli_query($link, "SELECT 1 FROM installs WHERE secret = '$authorisationheader' LIMIT 1");
+while($row = mysqli_fetch_array($getauthqry)){
+    if($row['1'] == '1'){
+        $auth = 'ok';
+    }
+}
+
+if($auth == 'ok'){
+    $getsecretqry = mysqli_query($link, "SELECT * from installs where secret = '$authorisationheader'");
+    while($row = mysqli_fetch_array($getsecretqry)){
+        $timegenerated = $row['timegenerated'];
+        $userid = $row['userid'];
+    }
+    $getuserqry = mysqli_query($link, "SELECT * from users where id = $userid");
+    while($row = mysqli_fetch_array($getuserqry)){
+        $active = $row['active'];
+    }
+    if(isset($do)){
+        if($do == "newasset" && isset($hostname)){
+            $assetsecret = substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', mt_rand(1,250))), 1, 250);
+            $addasset = "INSERT INTO assets (name, token) values (?, ?)";
+            if($stmt = mysqli_prepare($link, $addasset)){
+                mysqli_stmt_bind_param($stmt, "ss", $hostname, $assetsecret);
+                if(mysqli_stmt_execute($stmt)){
+                    echo $assetsecret;
+                    exit;
+                }else{
+                    echo "1";
+                }
+            }
+        }
+    }
+}

+ 2 - 0
WebPage/inform/return/error_log

@@ -0,0 +1,2 @@
+[04-Nov-2022 20:17:03 UTC] PHP Warning:  Undefined variable $shell in /home/endurcom/rmm.endur4.com/inform/return/index.php on line 36
+[04-Nov-2022 20:17:03 UTC] PHP Warning:  Undefined variable $script in /home/endurcom/rmm.endur4.com/inform/return/index.php on line 36

+ 42 - 0
WebPage/inform/return/index.php

@@ -0,0 +1,42 @@
+<?php
+
+require_once "../../config.php";
+
+if(isset($_GET['schedid'])){
+    $schedid = $_GET['schedid'];
+}
+if(isset($_GET['hostname'])){
+    $hostname = $_GET['hostname'];
+}
+
+$authorisationheader = getallheaders()['Authorization'];
+
+$getauthqry = mysqli_query($link, "SELECT 1 FROM assets WHERE token = '$authorisationheader' AND name = '$hostname' LIMIT 1");
+while($row = mysqli_fetch_array($getauthqry)){
+    if($row['1'] == '1'){
+        $auth = 'ok';
+    }
+}
+
+if($auth == 'ok'){
+    $getassetqry = mysqli_query($link, "SELECT * FROM assets WHERE token = '$authorisationheader' AND name = '$hostname'");
+    while($row = mysqli_fetch_array($getassetqry)){
+        $assetid = $row['id'];
+        $active = $row['active'];
+    }
+    if($active == 1){
+        $status = trim($_POST["status"]);
+        $output = trim($_POST["output"]);
+        $date = new \DateTime();
+        $datenow = $date->format("Y-m-d H:i:s");
+        $sql = "UPDATE schedules SET status = ?, output = ? WHERE id = ?";
+        if($stmt = mysqli_prepare($link, $sql)){
+            mysqli_stmt_bind_param($stmt, "ssi", $status, $output, $schedid);
+            if(mysqli_stmt_execute($stmt)){
+                exit();
+            } else{
+                echo 0;
+            }
+        }
+    }
+}

+ 9 - 0
WebPage/inform/run/error_log

@@ -0,0 +1,9 @@
+[04-Nov-2022 20:02:55 UTC] PHP Fatal error:  Uncaught ArgumentCountError: The number of variables must match the number of parameters in the prepared statement in /home/endurcom/rmm.endur4.com/inform/run/index.php:44
+Stack trace:
+#0 /home/endurcom/rmm.endur4.com/inform/run/index.php(44): mysqli_stmt_bind_param()
+#1 {main}
+  thrown in /home/endurcom/rmm.endur4.com/inform/run/index.php on line 44
+[04-Nov-2022 20:03:23 UTC] PHP Warning:  Undefined variable $shell in /home/endurcom/rmm.endur4.com/inform/run/index.php on line 46
+[04-Nov-2022 20:03:23 UTC] PHP Warning:  Undefined variable $script in /home/endurcom/rmm.endur4.com/inform/run/index.php on line 46
+[04-Nov-2022 20:05:35 UTC] PHP Warning:  Undefined variable $shell in /home/endurcom/rmm.endur4.com/inform/run/index.php on line 46
+[04-Nov-2022 20:05:35 UTC] PHP Warning:  Undefined variable $script in /home/endurcom/rmm.endur4.com/inform/run/index.php on line 46

+ 53 - 0
WebPage/inform/run/index.php

@@ -0,0 +1,53 @@
+<?php
+
+require_once "../../config.php";
+
+if(isset($_GET['schedid'])){
+    $schedid = $_GET['schedid'];
+}
+if(isset($_GET['scriptid'])){
+    $scriptid = $_GET['scriptid'];
+}
+if(isset($_GET['hostname'])){
+    $hostname = $_GET['hostname'];
+}
+
+$authorisationheader = getallheaders()['Authorization'];
+
+$getauthqry = mysqli_query($link, "SELECT 1 FROM assets WHERE token = '$authorisationheader' AND name = '$hostname' LIMIT 1");
+while($row = mysqli_fetch_array($getauthqry)){
+    if($row['1'] == '1'){
+        $auth = 'ok';
+    }
+}
+
+if($auth == 'ok'){
+    $getassetqry = mysqli_query($link, "SELECT * FROM assets WHERE token = '$authorisationheader' AND name = '$hostname'");
+    while($row = mysqli_fetch_array($getassetqry)){
+        $assetid = $row['id'];
+        $active = $row['active'];
+    }
+    if($active == 1){
+        $getscriptidqry = mysqli_query($link, "SELECT * FROM schedules WHERE id = $schedid");
+        while($row = mysqli_fetch_array($getscriptidqry)){
+            $scriptid = $row['scriptid'];
+        }
+        $getscriptqry = mysqli_query($link, "SELECT * FROM scripts WHERE id = $scriptid");
+        while($row = mysqli_fetch_array($getscriptqry)){
+            $shell = $row['shell'];
+            $script = $row['data'];
+        }
+        $date = new \DateTime();
+        $datenow = $date->format("Y-m-d H:i:s");
+        $sql = "UPDATE schedules SET rantime = ?, status = 'runnning' WHERE id = ?";
+        if($stmt = mysqli_prepare($link, $sql)){
+            mysqli_stmt_bind_param($stmt, "si", $datenow, $schedid);
+            if(mysqli_stmt_execute($stmt)){
+                echo "$shell:$script";
+                exit();
+            } else{
+                echo 0;
+            }
+        }
+    }
+}

+ 15 - 0
WebPage/php.ini

@@ -0,0 +1,15 @@
+; cPanel-generated php ini directives, do not edit
+; Manual editing of this file may result in unexpected behavior.
+; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
+; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
+
+display_errors = On
+max_execution_time = 30
+max_input_time = 60
+max_input_vars = 1000
+memory_limit = 128M
+post_max_size = 128M
+session.gc_maxlifetime = 1440
+session.save_path = "/opt/alt/php80/var/lib/php/session"
+upload_max_filesize = 2M
+zlib.output_compression = Off

+ 0 - 64
WebPage/place/alerts.php

@@ -1,64 +0,0 @@
-<div class="dashcollumn">
-<?php
-
-$getckqry = mysqli_query($link, "SELECT * FROM checks WHERE id = $chk");
-while($row = mysqli_fetch_array($getckqry)){
-    $chkname = $row['name'];
-    $chksection = $row['section'];
-    $chkstring = $row['string'];
-}
-echo "<a>Rappports avec des résultats</a>";
-$getentryqry = mysqli_query($link, "SELECT * FROM entries WHERE section = '$chksection' AND (
-    data1 LIKE '%$chkstring%' OR
-    data2 LIKE '%$chkstring%' OR
-    data3 LIKE '%$chkstring%' OR
-    data4 LIKE '%$chkstring%' OR
-    data5 LIKE '%$chkstring%' OR
-    data6 LIKE '%$chkstring%' OR
-    data7 LIKE '%$chkstring%') GROUP BY repportid");
-while($row = mysqli_fetch_array($getentryqry)){
-    $getreqid = mysqli_query($link, "SELECT * FROM repports WHERE id = ".$row['repportid']);
-    while($row = mysqli_fetch_array($getreqid)){
-        $repid = $row['id'];
-        $reqid = $row['reqid'];
-        $reptime = $row['inserted'];
-    }
-    $getcltid = mysqli_query($link, "SELECT * FROM request WHERE id = $reqid");
-    while($row = mysqli_fetch_array($getcltid)){
-        $clientid = $row['clientid'];
-    }
-    $getclient = mysqli_query($link, "SELECT * FROM clients WHERE id = $clientid");
-    while($row = mysqli_fetch_array($getclient)){
-        $clientname = $row['full_name'];
-    }
-    echo "<a href='?a=ckvw&chk=$chk&repid=$repid' class='collumnbutton'>$clientname $reptime</a>";
-}
-
-?>
-</div>
-<div class="dashcollumn">
-<?php
-    if(!isset($repportid)){
-        echo "<h1>Éléments à surveiller</h1>";
-        $getcltqry = mysqli_query($link, "SELECT * FROM checks");
-        while($row = mysqli_fetch_array($getcltqry)){
-            echo "<a class='collumnbutton' href='?a=ckvw&chk=".$row['id']."'>".$row['name']."</a><br>";
-        }
-    }else{
-        echo $chkname;
-        $getresqry = mysqli_query($link, "SELECT * FROM entries WHERE section = '$chksection' AND repportid = $repportid AND (
-            data1 LIKE '%$chkstring%' OR
-            data2 LIKE '%$chkstring%' OR
-            data3 LIKE '%$chkstring%' OR
-            data4 LIKE '%$chkstring%' OR
-            data5 LIKE '%$chkstring%' OR
-            data6 LIKE '%$chkstring%' OR
-            data7 LIKE '%$chkstring%')");
-        while($row = mysqli_fetch_array($getresqry)){
-            echo "<a class='collumnbutton'>".$row['data1']." ".$row['data2']." ".$row['data3']." ".$row['data4']." ".$row['data5']." ".$row['data6']." ".$row['data7']."</a><br>";
-        }
-    }
-    
-
-?>
-</div>

+ 88 - 0
WebPage/place/assets.php

@@ -0,0 +1,88 @@
+<div class="launchcollumn">
+    <a>Assets</a><br>
+    <?php
+    
+    $getaassetqry = mysqli_query($link, "select * from assets where active=1 ORDER BY name ASC");
+    while($row = mysqli_fetch_array($getaassetqry)){
+        echo "<a href='?a=assets&asset=".$row['id']."' class='collumnbutton'>".$row['name']."</a>";
+    }
+
+    ?>
+</div>
+
+<?php
+
+if(isset($asset)){
+    echo "<div class='launchcollumn'>";
+    echo "<a>Informations</a>";
+    $getinfqry = mysqli_query($link, "SELECT * from assets where id = $asset");
+    while($row = mysqli_fetch_array($getinfqry)){
+        $assetdesc = $row['description'];
+    }
+    echo "<a class='collumnbutton'>$assetdesc</a>";
+    echo "<a href='?a=assets&asset=$asset&do=scripts' class='collumnbutton'>Exécution Scripts</a>";
+    echo "</div>";
+
+    if(isset($do) && $do == 'scripts'){
+        echo "<div class='launchcollumn'>";
+        echo "<a>Scripts</a>";
+        echo "<a href='?a=assets&asset=$asset&do=$do&sched=new' class='collumnbutton'>New</a>";
+        $getschedqry = mysqli_query($link, "SELECT * from schedules where assetid = $asset ORDER BY runtime DESC");
+        while($row = mysqli_fetch_array($getschedqry)){
+            $scriptid = $row['scriptid'];
+            $schedtime = $row['runtime'];
+            $schedid = $row['id'];
+            $getscriptqry = mysqli_query($link, "SELECT * from scripts where id = $scriptid");
+            while($row = mysqli_fetch_array($getscriptqry)){
+                $scriptname = $row['name'];
+            }
+            echo "<a href='?a=assets&asset=$asset&do=$do&sched=$schedid' class='collumnbutton'>$scriptname $schedtime</a>";
+        }
+        echo "</div>";
+        if(isset($sched) && $sched != 'new' && $sched != 'set'){
+            $getschedqry = mysqli_query($link, "SELECT * from schedules where id = $sched");
+            while($row = mysqli_fetch_array($getschedqry)){
+                $scriptid = $row['scriptid'];
+                $schedtime = $row['runtime'];
+                $rantime = $row['rantime'];
+                $status = $row['status'];
+                $output = $row['output'];
+                $userid = $row['userid'];
+            }
+            $getscriptqry = mysqli_query($link, "SELECT * from scripts where id = $scriptid");
+            while($row = mysqli_fetch_array($getscriptqry)){
+                $scriptname = $row['name'];
+                $scriptdesc = $row['description'];
+            }
+            $getuserqry = mysqli_query($link, "SELECT * from users where id = $userid");
+            while($row = mysqli_fetch_array($getuserqry)){
+                $username = $row['username'];
+            }
+            echo "<div class='launchcollumn'>";
+            echo "<a>$scriptname</a>";
+            echo "<a class='collumnbutton'>$scriptdesc</a>";
+            echo "<a class='collumnbutton'>Time: $schedtime</a>";
+            echo "<a class='collumnbutton'>CMD retreived: $rantime</a>";
+            echo "<a class='collumnbutton'>Status: $status</a>";
+            echo "<a class='collumnbutton'>Output: $output</a>";
+            echo "<a class='collumnbutton'>Ran by: $username</a>";
+        }elseif(isset($sched) && $sched == 'new'){
+            echo "<div class='launchcollumn'>";
+            echo "<a>New</a>";
+            $getscriptsqry = mysqli_query($link, "SELECT * from scripts");
+            while($row = mysqli_fetch_array($getscriptsqry)){
+                echo "<a href='?a=assets&asset=$asset&do=$do&sched=set&newscriptid=".$row['id']."' class='collumnbutton'>".$row['name']."</a>";
+            }
+        }elseif(isset($sched) && $sched == 'set'){
+            echo "<div class='launchcollumn'>";
+            echo "<a>Set time</a>
+            <form action='?a=assets&asset=$asset&do=$do&sched=save&newscriptid=$newscriptid' method='POST'>
+            <input type='text' name='datetime' class='input' placeholder='yyyy-MM-dd HH:mm:ss'>
+            <input type='submit' class='button' value='Save'>
+            </form>";
+            echo "</div>";
+        }
+    }
+}
+
+?>

+ 0 - 34
WebPage/place/bug.php

@@ -1,34 +0,0 @@
-<div class="launchcollumn">
-    <a>Vérifications</a><br>
-    <?php
-    
-    $getcltqry = mysqli_query($link, "select * from checks");
-    while($row = mysqli_fetch_array($getcltqry)){
-        echo "<a href='?a=cklst&chk=".$row['id']."' class='collumnbutton'>".$row['name']."</a>";
-    }
-    echo "<a href='?a=cklst&chkadd' class='button'>Ajouter</a>";
-
-    ?>
-</div>
-
-<?php
-
-if(isset($chk)){
-    echo "<div class='launchcollumn'>";
-    echo "<a>Visualiser</a>";
-    $getreqqry = mysqli_query($link, "SELECT * from checks where id = $chk");
-    while($row = mysqli_fetch_array($getreqqry)){
-        echo "<a href='?a=repports&clt=$cltid&req=".$row['id']."' class='collumnbutton'>Titre: ".$row['name']."</a>";
-        echo "<a href='?a=repports&clt=$cltid&req=".$row['id']."' class='collumnbutton'>Section: ".$row['section']."</a>";
-        echo "<a href='?a=repports&clt=$cltid&req=".$row['id']."' class='collumnbutton'>Valeur: ".$row['string']."</a>";
-    }
-    echo "</div>";
-}
-
-if(isset($_GET['chkadd'])){
-    echo "<div class='launchcollumn'>";
-    echo "<a>Ajouter une vérification</a>";
-    echo "</div>";
-}
-
-?>

+ 0 - 30
WebPage/place/clients.php

@@ -1,30 +0,0 @@
-<div class="launchcollumn">
-    <a>Clients</a><br>
-    <?php
-    
-    $getcltqry = mysqli_query($link, "select * from clients where active=1 ORDER BY full_name ASC");
-    while($row = mysqli_fetch_array($getcltqry)){
-        echo "<a href='?a=clients&clt=".$row['id']."' class='collumnbutton'>".$row['full_name']."</a>";
-    }
-
-    ?>
-</div>
-
-<?php
-
-if(isset($cltid)){
-    echo "<div class='launchcollumn'>";
-    echo "<a>Infos</a>";
-    $getreqqry = mysqli_query($link, "SELECT * from clients where id = $cltid");
-    while($row = mysqli_fetch_array($getreqqry)){
-        echo "<a class='collumnbutton'>Nom complet: ".$row['full_name']."</a>";
-        echo "<a class='collumnbutton'>Préfix: ".$row['prefix']."</a>";
-        echo "<a class='collumnbutton'>Identifiant CRM: ".$row['num']."</a>";
-    }
-    echo "<a class='button button-left'>Sauvegarder</a>";
-    echo "<a class='button button-left'>Désactiver</a>";
-    echo "</div>";
-}
-
-
-?>

+ 0 - 15
WebPage/place/dashboard.php

@@ -9,16 +9,6 @@
     </tr>
 <?php
 
-$getcltqry = mysqli_query($link, "SELECT *,COUNT(*) FROM entries WHERE section = 'eventvwr' GROUP BY data2, data3, data4 ORDER BY COUNT(*) DESC");
-while($row = mysqli_fetch_array($getcltqry)){
-    echo "<tr>";
-    echo "<th>".$row['data2']."</th>";
-    echo "<th>".$row['data3']." ".$row['data4']."</th>";
-    echo "<th>".$row['data1']."</th>";
-    echo "<th>".$row['COUNT(*)']."</th>";
-    echo "</tr>";
-}
-
 ?>
     </table>
 </div>
@@ -26,10 +16,5 @@ while($row = mysqli_fetch_array($getcltqry)){
     <h1>Éléments à surveiller</h1>
 <?php
 
-$getcltqry = mysqli_query($link, "SELECT * FROM checks");
-while($row = mysqli_fetch_array($getcltqry)){
-    echo "<a class='collumnbutton' href='?a=ckvw&chk=".$row['id']."'>".$row['name']."</a><br>";
-}
-
 ?>
 </div>

+ 13 - 11
WebPage/place/getvalues.php

@@ -4,11 +4,24 @@ $currentusr = $_SESSION["username"];
 $isadminqry = mysqli_query($link, "select * from users where username='".$currentusr."'");
 while($row = mysqli_fetch_array($isadminqry)){
   $admin = $row['admin'];
+  $userid = $row['id'];
 }
 
 if(isset($_GET['a'])){
     $place = $_GET['a'];
 }
+if(isset($_GET['asset'])){
+    $asset = $_GET['asset'];
+}
+if(isset($_GET['do'])){
+    $do = $_GET['do'];
+}
+if(isset($_GET['sched'])){
+    $sched = $_GET['sched'];
+}
+if(isset($_GET['newscriptid'])){
+    $newscriptid = $_GET['newscriptid'];
+}
 if(isset($_GET['req'])){
     $req = trim($_GET['req']);
 }
@@ -129,17 +142,6 @@ if(isset($repdn)){
     }
 }
 
-if($rep == "done"){
-    $finreqqry = "UPDATE request SET approved = 3 WHERE id = ?";
-    if($stmt = mysqli_prepare($link, $finreqqry)){
-        mysqli_stmt_bind_param($stmt, "i", $req);
-        if(mysqli_stmt_execute($stmt)){
-            header("location: ?a=launch");
-            exit();
-        }
-    }
-}
-
 require "place/theme.php";
 
 ?>

+ 0 - 129
WebPage/place/launch.php

@@ -1,129 +0,0 @@
-<div class="launchcollumn">
-    <a>Maintenances</a><br>
-    <?php
-    $getreqqry = mysqli_query($link, "select * from request where approved!=3");
-    while($row = mysqli_fetch_array($getreqqry)){
-        echo "<a href='?a=launch&req=".$row['id']."' class='collumnbutton'>".$row['servername']." ".$row['treated_by']."</a>";
-        $approved = $row['approved'];
-        $servername = $row['servername'];
-        $treated_by = $row['treated_by'];
-        $clientid = $row['clientid'];
-    }
-    ?>
-</div>
-<?php
-
-if(isset($req)){
-    $getreqqry = mysqli_query($link, "select * from request where id = $req");
-    while($row = mysqli_fetch_array($getreqqry)){
-        $approved = $row['approved'];
-        $servername = $row['servername'];
-        $treated_by = $row['treated_by'];
-        $clientid = $row['clientid'];
-    }
-    $getcltqry = mysqli_query($link, "select * from clients where id=$clientid");
-    while($row = mysqli_fetch_array($getcltqry)){
-        $clientname = $row['full_name'];
-    }
-    echo "
-    <div class='launchcollumn'>
-    <a>Info</a><br>
-    <a>Serveur Maitre: $servername</a></br>
-    <a>Traité par: $treated_by</a></br>";
-    if($approved == 0){
-        echo "
-        <a href='?a=launch&req=$req&acc=yes' class='collumnbutton'>accepter</a>";
-    }elseif($approved == 1){
-        echo "<a>Status: Accepted</a><br>";
-        if($clientid != 0){
-            echo "<a href='?a=launch&req=$req&acc=class' class='collumnbutton'>Client: $clientname</a><br>";
-            echo "<a href='?a=launch&req=$req&acc=rapp' class='collumnbutton'>Serveurs/Équipements</a>";
-            #echo "<a href='?a=launch&req=$req&acc=reqend' class='collumnbutton'>Terminer la maintenance</a>";
-            #echo "<a href='?a=launch&req=$req&acc=reqcont' class='collumnbutton'>Continuer la maintenance</a>";
-        }else{
-            echo "<a href='?a=launch&req=$req&acc=class' class='collumnbutton'>Choisir Client</a>";
-        }
-    }else{
-        echo "<a>Status: Refusé</a><br>";
-    }
-    echo "</div>";
-}
-if(isset($acc)){
-    if($acc == "class"){
-        echo "
-        <div class='launchcollumn'>
-        <a>Choisir Client</a>";
-        $getclientqry = mysqli_query($link, "select * from clients where active = 1 ORDER BY full_name ASC");
-        while($row = mysqli_fetch_array($getclientqry)){
-            echo "<a href='?a=launch&acc=cltclass&req=$req&clt=".$row['id']."' class='collumnbutton'>".$row['full_name']."</a><br>";
-        }
-        echo "</div>";
-    }elseif($acc == "rapp"){
-        echo "
-        <div class='launchcollumn'>
-        <a>Serveurs</a><br>";
-        $getreppqry = mysqli_query($link, "select * from repports where reqid = $req AND repstat = 0");
-        while($row = mysqli_fetch_array($getreppqry)){
-            if($row['id'] == $rep){$repselect = "background-color:black;color:white";}
-            echo "<a href='?a=launch&acc=rapp&req=$req&rep=".$row['id']."' class='collumnbutton' style='$repselect'>".$row['server_name']."</a><br>";
-            $repselect = "";
-            $thereisvalue = 1;
-        }
-        echo "<a href='?a=launch&acc=rapp&req=$req&rep=new' class='collumnbutton'>Ajouter</a><br>";
-        if($thereisvalue != 1){
-            echo "<a href='?a=launch&acc=rapp&req=$req&rep=done' class='collumnbutton'>Terminer la maintenance</a><br>";
-        }
-        echo "</div>";
-    }
-}
-if(isset($rep)){
-    if($rep == "new"){
-        if(isset($dvctp)){
-            $getdevicesqry = mysqli_query($link, "select * from devicetypes where id=$dvctp");
-            while($row = mysqli_fetch_array($getdevicesqry)){
-                $devicetype = ": ".$row['name'];
-            }
-        }
-        echo "
-        <a>Nouveau Serveur/Équipement</a>
-        <div class='launchcollumn'>
-        <form action='?a=launch&acc=rapp&req=$req&rep=new&dvctp=$dvctp' method='post'>
-        <input type='text' name='name' class='input' placeholder='Nom'><input type='submit' class='button' placeholder='value'><br>
-        <div class='inputbtn'><a class='collumnbutton'>Type appareil$devicetype</a>";
-        $getdevicesqry = mysqli_query($link, "select * from devicetypes");
-        while($row = mysqli_fetch_array($getdevicesqry)){
-            echo "<span><a class='inputbtn-content' href='?a=launch&acc=rapp&req=$req&rep=new&dvctp=".$row['id']."'>".$row['name']."</a></span>";
-        }
-        echo "</div>
-        </input>
-        </form>";
-        echo "</div>";
-    }else{
-        echo "
-        <div class='launchcollumn'>
-        <a>Étapes</a>";
-        $getrepportqry = mysqli_query($link, "select * from repports where id = $rep");
-        while($row = mysqli_fetch_array($getrepportqry)){
-            $stepsdone = $row['stepsdone'];
-            $servername = $row['server_name'];
-            $devicetype = $row['devicetype'];
-        }
-        echo "<a class='collumnbutton'>".$servername."</a><br>";
-        $getstepsqry = mysqli_query($link, "select * from steps where eqqtypes LIKE '%$devicetype%'");
-        while($row = mysqli_fetch_array($getstepsqry)){
-            $rowname = $row['name'];
-            $rowid = $row['id'];
-            if(strpos("$stepsdone", "<$rowid>")){
-                echo "<div class='collumnsection'>$rowname<a href='?a=launch&acc=rapp&req=$req&rep=$rep&stpdn=$rowid' class='button-small success'>Fait ✓</a></div><br>";
-            }else{
-                echo "<div class='collumnsection'>$rowname<a href='?a=launch&acc=rapp&req=$req&rep=$rep&stpdn=$rowid' class='button-small neutral'>Fait</a></div><br>";
-                $notdone = 1;
-            }
-        }
-        if(!isset($notdone)){
-            echo "<div class='collumnsection'>Équipement terminé<a href='?a=launch&acc=rapp&req=$req&rep=$rep&repdn=1' class='button-small neutral'>Fait</a></div><br>";
-        }
-        echo "</div>";
-    }
-}
-?>

+ 7 - 11
WebPage/place/login.php

@@ -1,16 +1,12 @@
 <?php
-if($place == "search"){
-    $searchstring = trim($_POST["searchstring"]);
-    header("location: ?a=search&searchstring=$searchstring");
-    exit();
-}elseif($place == "launch"){
-    if(isset($dvctp)){
-        $newname = trim($_POST["name"]);
-        $addrepport = "INSERT INTO repports (reqid, server_name, devicetype) values ($req, ?, ?)";
-        if($stmt = mysqli_prepare($link, $addrepport)){
-            mysqli_stmt_bind_param($stmt, "si", $newname, $dvctp);
+if($place == "assets" && $sched == "save"){
+    if(isset($newscriptid)){
+        $schedtime = trim($_POST["datetime"]);
+        $addsched = "INSERT INTO schedules (assetid, scriptid, runtime, userid) values (?, ?, ?, ?)";
+        if($stmt = mysqli_prepare($link, $addsched)){
+            mysqli_stmt_bind_param($stmt, "iisi", $asset, $newscriptid, $schedtime, $userid);
             if(mysqli_stmt_execute($stmt)){
-                header("location: ?a=launch&acc=rapp&req=$req&acc=rapp");
+                header("location: ?a=assets&asset=$asset&do=scripts");
                 exit;
             }else{
                 echo "Oops! Something went wrong. Please try again later.";

+ 0 - 227
WebPage/place/rep.php

@@ -1,227 +0,0 @@
-<?php
-
-$getcltqry = mysqli_query($link, "SELECT * from entries where repportid = $rep AND section = 'Server'");
-while($row = mysqli_fetch_array($getcltqry)){
-    $servername = $row['data1'];
-    $repdate = $row['data2'];
-}
-
-?>
-<div class="repcollumn">
-    <a class="reptitle"><?php echo $servername; ?> <?php echo $repdate; ?></a>
-
-    <a class="reptitle2">Performance</a>
-    <table class="reptable">
-        <tr>
-            <th>CPU / Utilisation</th>
-            <th>RAM / Utilisation</th>
-            <th>Disques / Espace Disponible</th>
-        </tr>
-    <?php
-    $getappqry = mysqli_query($link, "SELECT * from entries where repportid = $rep AND servername = '$servername' AND section = 'SystemInfo'");
-    while($row = mysqli_fetch_array($getappqry)){
-        echo "
-        <tr>
-            <th>".$row['data2']."</th>
-            <th>".$row['data3']."</th>
-            <th>".$row['data4']."</th>
-        </tr>
-        ";
-    }
-    ?>
-
-    <a class="reptitle2">Applications</a>
-    <table class="reptable">
-        <tr>
-            <th>Nom</th>
-            <th>Emplacement</th>
-            <th>Désinstallé</th>
-        </tr>
-    <?php
-    $getappqry = mysqli_query($link, "SELECT * from entries where repportid = $rep AND servername = '$servername' AND section = 'Apps'");
-    while($row = mysqli_fetch_array($getappqry)){
-        echo "
-        <tr>
-            <th>".$row['data1']."</th>
-            <th>".$row['data2']."</th>
-            <th>".$row['data3']."</th>
-        </tr>
-        ";
-    }
-    ?>
-    </table>
-    <a class="reptitle2">Event Log</a>
-    <table class="reptable">
-        <tr>
-            <th>Log</th>
-            <th>Sévérité</th>
-            <th>Source</th>
-            <th>Dernière Occurence</th>
-            <th>EventID</th>
-            <th>Occurence</th>
-        </tr>
-    <?php
-    $getevntqry = mysqli_query($link, "SELECT *,COUNT(*) from entries where repportid = $rep AND servername = '$servername' AND section = 'eventvwr' GROUP BY data2");
-    while($row = mysqli_fetch_array($getevntqry)){
-        $style = "";
-        $style2 = "";
-        if($row['COUNT(*)'] > 50 && $row['COUNT(*)'] < 150){
-            $style = "style='background-color:yellow;'";
-        }elseif($row['COUNT(*)'] > 149 && $row['COUNT(*)'] < 500){
-            $style = "style='background-color:red;'";
-        }elseif($row['COUNT(*)'] > 499){
-            $style = "style='background-color:darkred;'";
-            $style2 = "style='background-color:darkred;'";
-        }elseif($row['COUNT(*)'] < 5){
-            continue;
-        }
-        echo "
-        <tr>
-            <th $style2>".$row['data3']."</th>
-            <th $style2>".$row['data4']."</th>
-            <th $style2 class='tooltip'>".$row['data2']."
-                <span class='tooltiptext'>".$row['data6']."</span>
-            </th>
-            <th $style2>".$row['data5']."</th>
-            <th $style2>".$row['data1']."</th>
-            <th $style>".$row['COUNT(*)']."</th>
-        </tr>
-        ";
-    }
-    ?>
-    </table>
-    </table>
-    <a class="reptitle2">Certificats</a>
-    <table class="reptable">
-        <tr>
-            <th>Nom Commun</th>
-            <th>Expiration</th>
-            <th>Thmubprint</th>
-        </tr>
-    <?php
-    $getevntqry = mysqli_query($link, "SELECT * from entries where repportid = $rep AND servername = '$servername' AND section = 'Certificates'");
-    while($row = mysqli_fetch_array($getevntqry)){
-        echo "
-        <tr>
-            <th>".$row['data1']."</th>
-            <th>".$row['data2']."</th>
-            <th>".$row['data3']."</th>
-        </tr>
-        ";
-    }
-    echo "</table>";
-
-    $getveeamqry = mysqli_query($link, "SELECT * from entries where repportid = $rep AND servername = '$servername' AND section = 'Veeam'");
-    if (mysqli_num_rows($getveeamqry) > 0){
-        echo "<a class='reptitle2'>État Veeam</a>
-        <table class='reptable'>
-            <tr>
-                <th>Nom de la tâche</th>
-                <th>Erreurs dans le dernier mois</th>
-                <th>Avertissements dans le dernier mois</th>
-                <th>Dernière exécution</th>
-                <th>Type de repo</th>
-                <th>Dernier résultat</th>
-            </tr>";
-        while($row = mysqli_fetch_array($getveeamqry)){
-            echo "
-            <tr>
-                <th>".$row['data1']."</th>
-                <th>".$row['data2']."</th>
-                <th>".$row['data3']."</th>
-                <th>".$row['data4']."</th>
-                <th>".$row['data5']."</th>
-                <th>".$row['data6']."</th>
-            </tr>
-            ";
-        }
-        echo "</table>";
-    }
-
-    $getveeamqry = mysqli_query($link, "SELECT * from entries where repportid = $rep AND servername = '$servername' AND section = 'VMwareHosts'");
-    if (mysqli_num_rows($getveeamqry) > 0){
-        echo "<a class='reptitle2'>Hôtes VMware</a>
-        <table class='reptable'>
-            <tr>
-                <th>Nom d'hôte</th>
-                <th>Utilisation du CPU</th>
-                <th>Utilisation de la RAM</th>
-                <th>Version</th>
-            </tr>";
-        while($row = mysqli_fetch_array($getveeamqry)){
-            echo "
-            <tr>
-                <th>".$row['data1']."</th>
-                <th>".$row['data2']."</th>
-                <th>".$row['data3']."</th>
-                <th>".$row['data4']."</th>
-            </tr>
-            ";
-        }
-        echo "</table>";
-    }
-
-    $getveeamqry = mysqli_query($link, "SELECT * from entries where repportid = $rep AND servername = '$servername' AND section = 'VMwareVMs'");
-    if (mysqli_num_rows($getveeamqry) > 0){
-        echo "<a class='reptitle2'>VM sans démarrage automatique</a>
-        <table class='reptable'>
-            <tr>
-                <th>Nom</th>
-                <th>Démarrage</th>
-            </tr>";
-        while($row = mysqli_fetch_array($getveeamqry)){
-            echo "
-            <tr>
-                <th>".$row['data1']."</th>
-                <th>".$row['data2']."</th>
-            </tr>
-            ";
-        }
-        echo "</table>";
-    }
-
-    $getveeamqry = mysqli_query($link, "SELECT * from entries where repportid = $rep AND servername = '$servername' AND section = 'VMwareDatastores'");
-    if (mysqli_num_rows($getveeamqry) > 0){
-        echo "<a class='reptitle2'>Datastores VMware</a>
-        <table class='reptable'>
-            <tr>
-                <th>Nom</th>
-                <th>Espace libre</th>
-                <th>Espace total</th>
-            </tr>";
-        while($row = mysqli_fetch_array($getveeamqry)){
-            echo "
-            <tr>
-                <th>".$row['data1']."</th>
-                <th>".$row['data2']."</th>
-                <th>".$row['data3']."</th>
-            </tr>
-            ";
-        }
-        echo "</table>";
-    }
-
-    $getveeamqry = mysqli_query($link, "SELECT * from entries where repportid = $rep AND servername = '$servername' AND section = 'VMwareAlerts'");
-    if (mysqli_num_rows($getveeamqry) > 0){
-        echo "<a class='reptitle2'>Alertes VMware</a>
-        <table class='reptable'>
-            <tr>
-                <th>Titre</th>
-                <th>Description</th>
-                <th>Temps</th>
-            </tr>";
-        while($row = mysqli_fetch_array($getveeamqry)){
-            echo "
-            <tr>
-                <th>".$row['data1']."</th>
-                <th>".$row['data2']."</th>
-                <th>".$row['data3']."</th>
-            </tr>
-            ";
-        }
-        echo "</table>";
-    }
-
-    ?>
-    </table>
-</div>

+ 0 - 39
WebPage/place/repports.php

@@ -1,39 +0,0 @@
-<div class="launchcollumn">
-    <a>Clients</a><br>
-    <?php
-    
-    $getcltqry = mysqli_query($link, "select * from clients where active=1 ORDER BY full_name ASC");
-    while($row = mysqli_fetch_array($getcltqry)){
-        echo "<a href='?a=repports&clt=".$row['id']."' class='collumnbutton'>".$row['full_name']."</a>";
-    }
-
-    ?>
-</div>
-
-<?php
-
-if(isset($cltid)){
-    echo "<div class='launchcollumn'>";
-    echo "<a>Maintenances</a>";
-    $getreqqry = mysqli_query($link, "SELECT * from request where clientid = $cltid ORDER BY timestamp DESC");
-    while($row = mysqli_fetch_array($getreqqry)){
-        echo "<a href='?a=repports&clt=$cltid&req=".$row['id']."' class='collumnbutton'>".$row['timestamp']."</a>";
-    }
-    echo "</div>";
-}
-
-if(isset($req)){
-    echo "<div class='launchcollumn'>";
-    echo "<a>Rapports</a>";
-    $getrepqry = mysqli_query($link, "SELECT * from repports where reqid = $req ORDER BY inserted DESC");
-    while($row = mysqli_fetch_array($getrepqry)){
-        echo "<a href='?a=repports&clt=$cltid&req=$req&rep=".$row['id']."' class='collumnbutton'>".$row['server_name']."</a>";
-    }
-    echo "</div>";
-}
-
-if(isset($rep)){
-    require "place/rep.php";
-}
-
-?>

+ 8 - 19
WebPage/place/search.php

@@ -8,22 +8,19 @@
             <img src="images/Umbrella MAAS 2.png" class="headerlogo">
             <div class="toprightmenu">
                 <a href="?a=logout" class="button button-right">Logout</a>
-                <a onClick="<?php if(!isset($place)){ echo "javascript:history.go(0)"; }else{ echo "javascript:history.go(-1)"; } ?>" class="button button-right">Retour</a>
-                <a onClick="window.location.reload()" class="button button-right">Rafraichir</a>
+                <a onClick="<?php if(!isset($place)){ echo "javascript:history.go(0)"; }else{ echo "javascript:history.go(-1)"; } ?>" class="button button-right">Back</a>
+                <a onClick="window.location.reload()" class="button button-right">Refresh</a>
             </div>
         </header>
         <leftmenu class="leftmenubox">
             <a href="?" class="leftmenumenu">Dashboard</a><br>
-            <a href="?a=launch" class="leftmenumenu">Exécution</a><br>
-            <a href="?a=clients" class="leftmenumenu">Clients</a><br>
-            <a href="?a=repports" class="leftmenumenu">Rapports</a><br>
-            <a href="?a=search" class="leftmenumenu">Recherche</a><br>
+            <a href="?a=assets" class="leftmenumenu">Assets</a><br>
+            <a href="?a=scripts" class="leftmenumenu">Scripts</a><br>
             <hr>
             <?php
 
             if($admin == 1) {
                 echo "
-                <a href='?a=cklst' class='leftmenumenu'>Vérifications</a><br>
                 <a href='?a=users' class='leftmenumenu'>Utilisateurs</a><br>
                 ";
             }
@@ -36,20 +33,12 @@
         <bodycontent class="contentbox">
             <?php
             
-            if($place == "launch"){
-                require "place/launch.php";
-            }elseif($place == "clients"){
-                require "place/clients.php";
+            if($place == "assets"){
+                require "place/assets.php";
+            }elseif($place == "scripts"){
+                require "place/scripts.php";
             }elseif($place == "users" & $admin == 1){
                 require "place/users.php";
-            }elseif($place == "repports"){
-                require "place/repports.php";
-            }elseif($place == "cklst"){
-                require "place/checks.php";
-            }elseif($place == "ckvw"){
-                require "place/alerts.php";
-            }elseif($place == "search"){
-                require "place/search.php";
             }elseif($place == "bug"){
                 require "place/bug.php";
             }else{

+ 0 - 0
WebPage/place/users.php