diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f6830d0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+connect.php
diff --git a/addNetwork.php b/addNetwork.php
new file mode 100644
index 0000000..7533693
--- /dev/null
+++ b/addNetwork.php
@@ -0,0 +1,27 @@
+Revenir en arrière");
+}
+
+$siteId = (int) $_POST['siteId'];
+$gateway = ip2long($_POST['gateway']);
+$mask = ip2long($_POST['mask']);
+$networkAddress = $gateway & $mask;
+
+include "connect.php";
+try {
+ $insert = $db->prepare("INSERT INTO Networks(Name, Address, Mask, SiteId) VALUES(:name, $networkAddress, $mask, $siteId)");
+ $insert->execute(['name' => $_POST['name']]);
+ $networkId = $db->lastInsertId();
+ $insert = $db->exec("INSERT INTO Hosts(IPAddress, NetworkId, Comments) VALUES($gateway, $networkId, 'Passerelle')");
+
+ header("Location: .?site=${_POST['siteName']}");
+} catch(Exception $e) {
+ echo($e->getMessage() . "
Revenir en arrière");
+}
+exit;
+?>
diff --git a/addSite.php b/addSite.php
new file mode 100644
index 0000000..795e4eb
--- /dev/null
+++ b/addSite.php
@@ -0,0 +1,14 @@
+Revenir en arrière");
+}
+include "connect.php";
+try {
+ $insert = $db->prepare("INSERT INTO Sites(Name) VALUES(:name)");
+ $insert->execute(['name' => $_POST['siteName']]);
+ header("Location: .?site=${_POST['siteName']}");
+ exit;
+} catch(Exception $e) {
+ echo($e->getMessage() . "
Revenir en arrière");
+}
+?>
\ No newline at end of file
diff --git a/connect.inc.php b/connect.inc.php
new file mode 100644
index 0000000..78c8b48
--- /dev/null
+++ b/connect.inc.php
@@ -0,0 +1,15 @@
+setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+} catch(Exception $e) {
+ die($e->getMessage() . "
Revenir en arrière");
+}
+?>
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..47ccd13
--- /dev/null
+++ b/index.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/nok.png b/nok.png
new file mode 100644
index 0000000..1efd421
Binary files /dev/null and b/nok.png differ
diff --git a/ok.png b/ok.png
new file mode 100644
index 0000000..54bd3d5
Binary files /dev/null and b/ok.png differ
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..497a48f
--- /dev/null
+++ b/script.js
@@ -0,0 +1,24 @@
+function updateHost(input) {
+ input.style.backgroundImage = 'url(wait.gif)'
+ input.style.fontStyle = "italic"
+ fetch(new Request("updateHost.php", {
+ method:"POST",
+ body:new FormData(input.form),
+ mode:"cors"
+ })).then(response => {
+ if (response.ok) {
+ input.style.backgroundImage = ''
+ input.style.fontStyle = ""
+ } else {
+ input.style.backgroundImage = 'url(nok.png)'
+ }
+ })
+}
+
+function checkMask(input) {
+ if (input.checkValidity()) {
+
+ } else {
+ input.setCustomValidity("Masque incorrect")
+ }
+}
\ No newline at end of file
diff --git a/siteNetworks.php b/siteNetworks.php
new file mode 100644
index 0000000..f90acd3
--- /dev/null
+++ b/siteNetworks.php
@@ -0,0 +1,103 @@
+prepare('SELECT id from Sites WHERE Name=:siteName');
+$site->execute(['siteName' => $siteName]);
+$siteId = $site->fetch()["id"];
+if (!$siteId) {
+ header("HTTP/1.1 404 Not Found");
+ die("Erreur ! Site inconnu : ${_GET["site"]}
Accueil");
+}
+?>
+
+
+
Adresse IP | +Nom d'hôte | +FQDN | +Adresse MAC | +Commentaires | +
---|---|---|---|---|
= long2ip($networkAddress)?> | +Adresse réseau | +|||
= long2ip($ip)?> | +Adresse de diffusion | +