diff --git a/idees.txt b/idees.txt new file mode 100644 index 0000000..11f1573 --- /dev/null +++ b/idees.txt @@ -0,0 +1 @@ +script ajax pour reload la page tte les Xs ? \ No newline at end of file diff --git a/web/class/Alerts.class.php b/web/class/Alerts.class.php new file mode 100644 index 0000000..b57b9aa --- /dev/null +++ b/web/class/Alerts.class.php @@ -0,0 +1,212 @@ +id; + } + + public function setId($id) + { + $this->id = $id; + } + + // Getter et Setter pour cef_version + public function getCefVersion() + { + return $this->cef_version; + } + + public function setCefVersion($cef_version) + { + $this->cef_version = $cef_version; + } + + // Getter et Setter pour date_alerte + public function getDateAlerte() + { + return $this->date_alerte; + } + + public function setDateAlerte($date_alerte) + { + $this->date_alerte = $date_alerte; + } + + // Getter et Setter pour event_gravite + public function getEventGravite() + { + return $this->event_gravite; + } + + public function setEventGravite($event_gravite) + { + $this->event_gravite = $event_gravite; + } + + // Getter et Setter pour device_product + public function getDeviceProduct() + { + return $this->device_product; + } + + public function setDeviceProduct($device_product) + { + $this->device_product = $device_product; + } + + // Getter et Setter pour device_vendor + public function getDeviceVendor() + { + return $this->device_vendor; + } + + public function setDeviceVendor($device_vendor) + { + $this->device_vendor = $device_vendor; + } + + // Getter et Setter pour device_version + public function getDeviceVersion() + { + return $this->device_version; + } + + public function setDeviceVersion($device_version) + { + $this->device_version = $device_version; + } + + // Getter et Setter pour alerte_name + public function getAlerteName() + { + return $this->alerte_name; + } + + public function setAlerteName($alerte_name) + { + $this->alerte_name = $alerte_name; + } + + // Getter et Setter pour destinationAddress + public function getDestinationAddress() + { + return $this->destinationAddress; + } + + public function setDestinationAddress($destinationAddress) + { + $this->destinationAddress = $destinationAddress; + } + + // Getter et Setter pour sourceAddress + public function getSourceAddress() + { + return $this->sourceAddress; + } + + public function setSourceAddress($sourceAddress) + { + $this->sourceAddress = $sourceAddress; + } + + // Getter et Setter pour destinationPort + public function getDestinationPort() + { + return $this->destinationPort; + } + + public function setDestinationPort($destinationPort) + { + $this->destinationPort = $destinationPort; + } + + // Getter et Setter pour sourcePort + public function getSourcePort() + { + return $this->sourcePort; + } + + public function setSourcePort($sourcePort) + { + $this->sourcePort = $sourcePort; + } + + // Getter et Setter pour protocol + public function getProtocol() + { + return $this->protocol; + } + + public function setProtocol($protocol) + { + $this->protocol = $protocol; + } + + // Getter et Setter pour applicationProtocol + public function getApplicationProtocol() + { + return $this->applicationProtocol; + } + + public function setApplicationProtocol($applicationProtocol) + { + $this->applicationProtocol = $applicationProtocol; + } + + // Getter et Setter pour reason + public function getReason() + { + return $this->reason; + } + + public function setReason($reason) + { + $this->reason = $reason; + } + + // Getter et Setter pour action + public function getAction() + { + return $this->action; + } + + public function setAction($action) + { + $this->action = $action; + } + + // Getter et Setter pour commentaire + public function getCommentaire() + { + return $this->commentaire; + } + + public function setCommentaire($commentaire) + { + $this->commentaire = $commentaire; + } +} + +?> diff --git a/web/class/Database.class.php b/web/class/Database.class.php index 48eaef6..2156cdd 100644 --- a/web/class/Database.class.php +++ b/web/class/Database.class.php @@ -8,7 +8,7 @@ class Database private $db_host; private $pdo; - public function __construct($db_name = "", $db_user = '', $db_pass = '', $db_host = 'localhost') + public function __construct($db_name = "sidps", $db_user = 'sidps', $db_pass = 'sidps', $db_host = 'localhost') { $this->db_name = $db_name; $this->db_user = $db_user; @@ -36,7 +36,7 @@ class Database // TOCHANGE public function getnbAlerts() { - $sql = 'SELECT COUNT(*) AS nb_alerts FROM alerts'; + $sql = 'SELECT COUNT(*) AS nb_alerts FROM alertes'; $sth = $this->getPDO()->prepare($sql); $sth->execute(); @@ -60,7 +60,7 @@ class Database $decalage = ($page - 1) * $limit; $sql = 'SELECT * - FROM alerts '; + FROM alertes '; if ($filters != null) { foreach ($filters as $key => $value) { @@ -74,9 +74,9 @@ class Database // TODO : edit filters if ($filters != null) { - if ($filters['date'] != '') $sth->bindParam('date', $filters['date']); - if ($filters['espece'] != '') $sth->bindParam('espece', $filters['espece']); - if ($filters['zone'] != '') $sth->bindParam('zone', $filters['zone']); + if ($filters['event_gravite'] != '') $sth->bindParam('event_gravite', $filters['event_gravite']); + if ($filters['device_product'] != '') $sth->bindParam('device_product', $filters['device_product']); + // if ($filters['zone'] != '') $sth->bindParam('zone', $filters['zone']); } $sth->bindParam(':limit', $limit, PDO::PARAM_INT); $sth->bindParam(':offset', $decalage, PDO::PARAM_INT); @@ -89,7 +89,7 @@ class Database { $whereArgs = []; $sql = 'SELECT * - FROM alerts '; + FROM alertes '; if ($filters != null) { foreach ($filters as $key => $value) { @@ -108,11 +108,11 @@ class Database return $sth->fetchAll(PDO::FETCH_CLASS, 'Alerts'); } - public function getAlertsByGravite() + public function getDevices() { - $sql = 'SELECT gravite - FROM alerts - GROUP BY gravite'; + $sql = 'SELECT device_product + FROM alertes + GROUP BY device_product'; $sth = $this->getPDO()->prepare($sql, [PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY]); $sth->execute(); @@ -130,9 +130,9 @@ class Database foreach ($filters as $key) { $whereArgs[] = $key; } - $sql = 'SELECT gravite, COUNT(*) as nbbygravite FROM Alerts where date>='. implode(' AND ', $whereArgs).' GROUP BY gravite'; + $sql = 'SELECT gravite, COUNT(*) as nbbygravite FROM alertes where date>='. implode(' AND ', $whereArgs).' GROUP BY gravite'; }else { - $sql = 'SELECT gravite, COUNT(*) as nbbygravite FROM Alerts GROUP BY gravite'; + $sql = 'SELECT gravite, COUNT(*) as nbbygravite FROM alertes GROUP BY gravite'; } diff --git a/web/class/alerts.php b/web/class/alerts.php deleted file mode 100644 index 46e01b4..0000000 --- a/web/class/alerts.php +++ /dev/null @@ -1,63 +0,0 @@ -id; - } - public function Getdate() - { - return $this->date; - } - public function Getespece() - { - return $this->espece; - } - public function Getzone() - { - return $this->zone; - } - public function Getnombre() - { - return $this->nombre; - } - - public function Setid($id) - { - $this->id = $id; - } - public function Setdate($date) - { - $this->date = $date; - } - public function Setespece($espece) - { - $this->espece = $espece; - } - public function Setzone($zone) - { - $this->zone = $zone; - } - public function Setnombre($nombre) - { - $this->nombre = $nombre; - } - - // function __construct($id, $date, $espece, $zone, $nombre) - // { - // $this->$id = $id; - // $this->$date = $date; - // $this->$espece = $espece; - // $this->$zone = $zone; - // $this->$nombre = $nombre; - // } -} diff --git a/web/index.php b/web/index.php index 491c2e0..f4e5e9f 100644 --- a/web/index.php +++ b/web/index.php @@ -7,7 +7,7 @@ spl_autoload_register(function ($class) { include 'class/' . $class . '.class.php'; }); -$db = new Database(); +$db = new Database(); ?> @@ -51,42 +51,32 @@ $db = new Database();
veuillez selectionner les filtres de recherche ou parcourez la liste ci-dessous
+