WIP
This commit is contained in:
85
index.php
85
index.php
@ -1,3 +1,4 @@
|
||||
<?php include_once "config.php"; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@ -6,27 +7,11 @@
|
||||
<title>lanScan</title>
|
||||
<link rel="icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<style>
|
||||
body {
|
||||
background-color: #1b1c1d;
|
||||
}
|
||||
|
||||
body > .grid {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo svg {
|
||||
width: 2.5em;
|
||||
height: 2.5em;
|
||||
fill: currentColor;
|
||||
margin: -.4em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@ -37,15 +22,23 @@
|
||||
<h2 class="ui inverted teal header logo">
|
||||
lan<?php include 'logo.svg'; ?>can
|
||||
</h2>
|
||||
<form id="scanForm" class="ui large form initial inverted">
|
||||
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
|
||||
<div class="ui left aligned stacked segment inverted">
|
||||
<h4 class=""ui header">Découvrir ou superviser un réseau</h4>
|
||||
<div class="inverted field">
|
||||
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
|
||||
<option value="">Nouveau réseau</option>
|
||||
<option value="10.92.8.0/24">10.92.8.0/24</option>
|
||||
<option value="10.93.8.0/24">10.93.8.0/24</option>
|
||||
<option value="10.94.8.0/24">10.94.8.0/24</option>
|
||||
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
|
||||
<?php
|
||||
if (file_exists($SCANDIR)) {
|
||||
foreach (scandir($SCANDIR) as $filename) {
|
||||
if (substr($filename, -4) === '.xml') {
|
||||
$name = substr($filename, 0, -4);
|
||||
$name = str_replace("!", "/", $name);
|
||||
echo " <option value='$name'>$name</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui error message"></div>
|
||||
@ -56,7 +49,7 @@
|
||||
</form>
|
||||
|
||||
<div class="ui inverted segment">
|
||||
<a href="#">Options avancées</a>
|
||||
<a href="options.php">Options avancées</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -66,27 +59,37 @@
|
||||
<script>
|
||||
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
|
||||
|
||||
lanSelect.checkValidity = () => /[a-zA-Z0-9._\/ \-]+/.test(lanSelect.value)
|
||||
|
||||
scanForm.onsubmit = function(event) {
|
||||
if (!scanForm.checkValidity()) {
|
||||
event.preventDefault()
|
||||
this.reportValidity()
|
||||
$('#scanForm').form({
|
||||
fields: {
|
||||
lan: {
|
||||
identifier: 'lanSelect',
|
||||
rules: [{
|
||||
type: 'regExp',
|
||||
value: /[a-zA-Z0-9._\/ \-]+/,
|
||||
prompt: "Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.<br/>Exemples : <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#scanForm').form({
|
||||
fields: {
|
||||
lan: {
|
||||
identifier: 'lanSelect',
|
||||
rules: [{
|
||||
type: 'regExp',
|
||||
value: /[a-zA-Z0-9._\/ \-]+/,
|
||||
prompt: "Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.<br/>Exemples : <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
scanForm.onsubmit = function(event) {
|
||||
if (this.checkValidity()) {
|
||||
scanForm.classList.add("loading")
|
||||
$.toast({
|
||||
title : 'Scan en cours...',
|
||||
message : 'Merci de patienter',
|
||||
class : 'info',
|
||||
showIcon : 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
return true
|
||||
} else {
|
||||
event.preventDefault()
|
||||
this.reportValidity()
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user