From 4aed96037d3005dce8ab6dbcd5176e1eafea6cf5 Mon Sep 17 00:00:00 2001 From: adrien Date: Thu, 21 Oct 2021 20:52:23 +0200 Subject: [PATCH] commit --- .gitignore | 2 +- 400.php | 11 ++++------- 404.php | 13 +++++-------- 500.php | 11 ++++------- config_db.php.inc | 7 +++++++ connect.inc.php => connect.php | 7 +------ index.php | 13 ++++++++----- js/script.js | 5 +++++ network.php | 10 ++++++---- site.php | 16 ++++++++++------ updateHost.php | 11 ++++++----- 11 files changed, 57 insertions(+), 49 deletions(-) create mode 100644 config_db.php.inc rename connect.inc.php => connect.php (61%) diff --git a/.gitignore b/.gitignore index f6830d0..7cbb7f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -connect.php +config_db.php diff --git a/400.php b/400.php index 72ff40c..97c0ec9 100644 --- a/400.php +++ b/400.php @@ -13,17 +13,14 @@ header("HTTP/1.1 400 Bad Request");
-
-

Erreur

+

Erreur

Données requises non reçues

arrow_backRetour
diff --git a/404.php b/404.php index b7f22dd..c215333 100644 --- a/404.php +++ b/404.php @@ -13,17 +13,14 @@ header("HTTP/1.1 404 Not Found");
-
-

Erreur

+

Erreur

La ressource demandée n'a pas été trouvée

arrow_backRetour
diff --git a/500.php b/500.php index ab1bae5..adf087e 100644 --- a/500.php +++ b/500.php @@ -13,17 +13,14 @@ header("HTTP/1.1 500 Internal Server Error");
-
-

Erreur

+

Erreur

Problème côté serveur

arrow_backRetour
diff --git a/config_db.php.inc b/config_db.php.inc new file mode 100644 index 0000000..329722d --- /dev/null +++ b/config_db.php.inc @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/connect.inc.php b/connect.php similarity index 61% rename from connect.inc.php rename to connect.php index 9d6309f..9840ae1 100644 --- a/connect.inc.php +++ b/connect.php @@ -1,10 +1,5 @@ setAttribute(PDO::ATTR_EMULATE_PREPARES, false); diff --git a/index.php b/index.php index 9d7993a..f554975 100644 --- a/index.php +++ b/index.php @@ -4,14 +4,16 @@ - +
@@ -21,7 +23,7 @@ query("SELECT * FROM `Sites` ORDER BY `Name`") as $site) { - print " ${site['Name']}\n"; + print " ${site['Name']}\n"; } ?>
@@ -34,9 +36,10 @@ foreach ($db->query("SELECT * FROM `Sites` ORDER BY `Name`") as $site) { - +
+
diff --git a/js/script.js b/js/script.js index 36581cb..f363133 100644 --- a/js/script.js +++ b/js/script.js @@ -5,6 +5,11 @@ function showCard(card, button) { } function updateHost(input) { + if (input.value) { + input.required = true + } else { + input.required = false + } if (input.form.checkValidity()) { var td = input.parentElement var tr = td.parentElement diff --git a/network.php b/network.php index bc3bcd9..d3fb79a 100644 --- a/network.php +++ b/network.php @@ -29,16 +29,18 @@ if (!$siteName) { - +
diff --git a/site.php b/site.php index aa64ecf..c0886a3 100644 --- a/site.php +++ b/site.php @@ -18,15 +18,17 @@ if (!$siteName) { - +
@@ -58,9 +60,11 @@ foreach ($db->query("SELECT * FROM `Networks` WHERE `SiteId` = $siteId ORDER BY
- +
+ +
diff --git a/updateHost.php b/updateHost.php index fafedf4..f2f8b29 100644 --- a/updateHost.php +++ b/updateHost.php @@ -14,11 +14,12 @@ if (is_null($ip) } include "connect.php"; try { - $update = $db->prepare(" - INSERT INTO Hosts(IpAddress, NetworkId, Hostname, FQDN, MacAddress, Link, Comments) - VALUES($ip, $networkId, :i_hostname, :i_fqdn, :i_macAddress, :i_link, :i_comments) - ON DUPLICATE KEY UPDATE Hostname = :u_hostname, FQDN = :u_fqdn, MacAddress = :u_macAddress, Comments = :u_comments, Link = :u_link - "); + $update = $db->prepare( + <<execute([ 'i_hostname' => $hostname, 'i_fqdn' => $fqdn,