mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-15 06:31:44 -07:00
add port number
This commit is contained in:
@@ -265,11 +265,17 @@ if ($_REQUEST['mac'] == 'Internet') { $DevDetail_Tap_temp = "Tools"; } else { $D
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">Infrastructure</label>
|
<label class="col-sm-3 control-label">Network Hardward</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input class="form-control" id="txtInfrastructure" type="text" value="--">
|
<input class="form-control" id="txtInfrastructure" type="text" value="--">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">Network HW Port</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input class="form-control" id="txtInfrastructurePort" type="text" value="--">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -1099,34 +1105,35 @@ function getDeviceData (readAllData=false) {
|
|||||||
$('#deviceStatus')[0].className = 'text-gray';
|
$('#deviceStatus')[0].className = 'text-gray';
|
||||||
$('#deviceStatusIcon')[0].className = '';
|
$('#deviceStatusIcon')[0].className = '';
|
||||||
|
|
||||||
$('#deviceSessions').html ('--');
|
$('#deviceSessions').html ('--');
|
||||||
$('#deviceDownAlerts').html ('--');
|
$('#deviceDownAlerts').html ('--');
|
||||||
$('#deviceEvents').html ('--');
|
$('#deviceEvents').html ('--');
|
||||||
|
|
||||||
$('#txtMAC').val ('--');
|
$('#txtMAC').val ('--');
|
||||||
$('#txtName').val ('--');
|
$('#txtName').val ('--');
|
||||||
$('#txtOwner').val ('--');
|
$('#txtOwner').val ('--');
|
||||||
$('#txtDeviceType').val ('--');
|
$('#txtDeviceType').val ('--');
|
||||||
$('#txtVendor').val ('--');
|
$('#txtVendor').val ('--');
|
||||||
|
|
||||||
$('#chkFavorite').iCheck ('uncheck');
|
$('#chkFavorite').iCheck ('uncheck');
|
||||||
$('#txtGroup').val ('--');
|
$('#txtGroup').val ('--');
|
||||||
$('#txtLocation').val ('--');
|
$('#txtLocation').val ('--');
|
||||||
$('#txtComments').val ('--');
|
$('#txtComments').val ('--');
|
||||||
$('#txtInfrastructure').val ('--');
|
$('#txtInfrastructure').val ('--');
|
||||||
|
$('#txtInfrastructurePort').val ('--');
|
||||||
|
|
||||||
$('#txtFirstConnection').val ('--');
|
$('#txtFirstConnection').val ('--');
|
||||||
$('#txtLastConnection').val ('--');
|
$('#txtLastConnection').val ('--');
|
||||||
$('#txtLastIP').val ('--');
|
$('#txtLastIP').val ('--');
|
||||||
$('#txtStatus').val ('--');
|
$('#txtStatus').val ('--');
|
||||||
$('#chkStaticIP').iCheck ('uncheck');
|
$('#chkStaticIP').iCheck ('uncheck');
|
||||||
|
|
||||||
$('#txtScanCycle').val ('--');
|
$('#txtScanCycle').val ('--');
|
||||||
$('#chkAlertEvents').iCheck ('uncheck')
|
$('#chkAlertEvents').iCheck ('uncheck')
|
||||||
$('#chkAlertDown').iCheck ('uncheck')
|
$('#chkAlertDown').iCheck ('uncheck')
|
||||||
$('#txtSkipRepeated').val ('--');
|
$('#txtSkipRepeated').val ('--');
|
||||||
$('#chkNewDevice').iCheck ('uncheck');
|
$('#chkNewDevice').iCheck ('uncheck');
|
||||||
$('#chkArchived').iCheck ('uncheck');
|
$('#chkArchived').iCheck ('uncheck');
|
||||||
|
|
||||||
$('#iconRandomMACactive').addClass ('hidden');
|
$('#iconRandomMACactive').addClass ('hidden');
|
||||||
$('#iconRandomMACinactive').removeClass ('hidden');
|
$('#iconRandomMACinactive').removeClass ('hidden');
|
||||||
@@ -1195,6 +1202,7 @@ function getDeviceData (readAllData=false) {
|
|||||||
$('#txtLocation').val (deviceData['dev_Location']);
|
$('#txtLocation').val (deviceData['dev_Location']);
|
||||||
$('#txtComments').val (deviceData['dev_Comments']);
|
$('#txtComments').val (deviceData['dev_Comments']);
|
||||||
$('#txtInfrastructure').val (deviceData['dev_Infrastructure']);
|
$('#txtInfrastructure').val (deviceData['dev_Infrastructure']);
|
||||||
|
$('#txtInfrastructurePort').val (deviceData['dev_Infrastructure_port']);
|
||||||
|
|
||||||
$('#txtFirstConnection').val (deviceData['dev_FirstConnection']);
|
$('#txtFirstConnection').val (deviceData['dev_FirstConnection']);
|
||||||
$('#txtLastConnection').val (deviceData['dev_LastConnection']);
|
$('#txtLastConnection').val (deviceData['dev_LastConnection']);
|
||||||
@@ -1304,6 +1312,7 @@ function setDeviceData (refreshCallback='') {
|
|||||||
+ '&location=' + $('#txtLocation').val()
|
+ '&location=' + $('#txtLocation').val()
|
||||||
+ '&comments=' + $('#txtComments').val()
|
+ '&comments=' + $('#txtComments').val()
|
||||||
+ '&infrastructure=' + $('#txtInfrastructure').val()
|
+ '&infrastructure=' + $('#txtInfrastructure').val()
|
||||||
|
+ '&infrastructureport=' + $('#txtInfrastructurePort').val()
|
||||||
+ '&staticIP=' + ($('#chkStaticIP')[0].checked * 1)
|
+ '&staticIP=' + ($('#chkStaticIP')[0].checked * 1)
|
||||||
+ '&scancycle=' + $('#txtScanCycle').val().split(' ')[0]
|
+ '&scancycle=' + $('#txtScanCycle').val().split(' ')[0]
|
||||||
+ '&alertevents=' + ($('#chkAlertEvents')[0].checked * 1)
|
+ '&alertevents=' + ($('#chkAlertEvents')[0].checked * 1)
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ if ($_SESSION["login"] != 1)
|
|||||||
require 'php/templates/header.php';
|
require 'php/templates/header.php';
|
||||||
require 'php/server/db.php';
|
require 'php/server/db.php';
|
||||||
|
|
||||||
|
|
||||||
$DBFILE = '../db/pialert.db';
|
$DBFILE = '../db/pialert.db';
|
||||||
OpenDB();
|
OpenDB();
|
||||||
// Create Table if not exists'
|
// #####################################
|
||||||
|
// ## Create Table if not exists'
|
||||||
|
// #####################################
|
||||||
$sql = 'CREATE TABLE IF NOT EXISTS "network_infrastructure" (
|
$sql = 'CREATE TABLE IF NOT EXISTS "network_infrastructure" (
|
||||||
"device_id" INTEGER,
|
"device_id" INTEGER,
|
||||||
"net_device_name" TEXT NOT NULL,
|
"net_device_name" TEXT NOT NULL,
|
||||||
@@ -20,13 +21,16 @@ $sql = 'CREATE TABLE IF NOT EXISTS "network_infrastructure" (
|
|||||||
PRIMARY KEY("device_id" AUTOINCREMENT)
|
PRIMARY KEY("device_id" AUTOINCREMENT)
|
||||||
)';
|
)';
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
// Expand Devices Table
|
// #####################################
|
||||||
|
// ## Expand Devices Table
|
||||||
|
// #####################################
|
||||||
$sql = 'ALTER TABLE "Devices" ADD "dev_Infrastructure" INTEGER';
|
$sql = 'ALTER TABLE "Devices" ADD "dev_Infrastructure" INTEGER';
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$sql = 'ALTER TABLE "Devices" ADD "dev_Infrastructure_port" INTEGER';
|
$sql = 'ALTER TABLE "Devices" ADD "dev_Infrastructure_port" INTEGER';
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
// #####################################
|
||||||
|
// Add New Network Devices
|
||||||
|
// #####################################
|
||||||
if ($_REQUEST['Networkinsert'] == "yes") {
|
if ($_REQUEST['Networkinsert'] == "yes") {
|
||||||
if (isset($_REQUEST['NetworkDeviceName']) && isset($_REQUEST['NetworkDeviceTyp']))
|
if (isset($_REQUEST['NetworkDeviceName']) && isset($_REQUEST['NetworkDeviceTyp']))
|
||||||
{
|
{
|
||||||
@@ -34,7 +38,9 @@ if ($_REQUEST['Networkinsert'] == "yes") {
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// #####################################
|
||||||
|
// remove Network Devices
|
||||||
|
// #####################################
|
||||||
if ($_REQUEST['Networkdelete'] == "yes") {
|
if ($_REQUEST['Networkdelete'] == "yes") {
|
||||||
if (isset($_REQUEST['NetworkDeviceID']))
|
if (isset($_REQUEST['NetworkDeviceID']))
|
||||||
{
|
{
|
||||||
@@ -63,10 +69,8 @@ echo $_REQUEST['device_id'];
|
|||||||
<div class="box box-default collapsed-box">
|
<div class="box box-default collapsed-box">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title">Verwalte Netzwerk-Geräte</h3>
|
<h3 class="box-title">Verwalte Netzwerk-Geräte</h3>
|
||||||
|
|
||||||
<div class="box-tools pull-right">
|
<div class="box-tools pull-right">
|
||||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||||
<!-- <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-remove"></i></button> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.box-header -->
|
<!-- /.box-header -->
|
||||||
@@ -102,7 +106,6 @@ echo $_REQUEST['device_id'];
|
|||||||
<select class="form-control" name="NetworkDeviceID">
|
<select class="form-control" name="NetworkDeviceID">
|
||||||
<option value="">-- Select Typ --</option>
|
<option value="">-- Select Typ --</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = 'SELECT "device_id", "net_device_name", "net_device_typ" FROM "network_infrastructure"';
|
$sql = 'SELECT "device_id", "net_device_name", "net_device_typ" FROM "network_infrastructure"';
|
||||||
$result = $db->query($sql);//->fetchArray(SQLITE3_ASSOC);
|
$result = $db->query($sql);//->fetchArray(SQLITE3_ASSOC);
|
||||||
while($res = $result->fetchArray(SQLITE3_ASSOC)){
|
while($res = $result->fetchArray(SQLITE3_ASSOC)){
|
||||||
@@ -126,7 +129,6 @@ echo $_REQUEST['device_id'];
|
|||||||
<!-- /.box-body -->
|
<!-- /.box-body -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
function createnetworktab($pia_func_netdevid, $pia_func_netdevname, $pia_func_netdevtyp, $activetab) {
|
function createnetworktab($pia_func_netdevid, $pia_func_netdevname, $pia_func_netdevtyp, $activetab) {
|
||||||
echo '<li class="'.$activetab.'"><a href="#'.$pia_func_netdevid.'" data-toggle="tab">'.$pia_func_netdevname.' / '.$pia_func_netdevtyp.'</a></li>';
|
echo '<li class="'.$activetab.'"><a href="#'.$pia_func_netdevid.'" data-toggle="tab">'.$pia_func_netdevname.' / '.$pia_func_netdevtyp.'</a></li>';
|
||||||
@@ -140,12 +142,11 @@ function createnetworktabcontent($pia_func_netdevid, $pia_func_netdevname, $pia_
|
|||||||
|
|
||||||
while($func_res = $func_result->fetchArray(SQLITE3_ASSOC)){
|
while($func_res = $func_result->fetchArray(SQLITE3_ASSOC)){
|
||||||
if(!isset($func_res['dev_Name'])) continue;
|
if(!isset($func_res['dev_Name'])) continue;
|
||||||
echo $func_res['dev_Name'].' - '.$func_res['dev_LastIP'].' - '.$func_res['dev_PresentLastScan'].'<br>';
|
if ($func_res['dev_PresentLastScan'] == 1) {$port_state = '<div class="badge bg-green text-white">Up</div>';} else {$port_state = '<div class="badge bg-red text-white">Down</div>';}
|
||||||
|
echo 'Port: '.$func_res['dev_Infrastructure_port'].' - '.$port_state.' - <a href="./deviceDetails.php?mac='.$func_res['dev_MAC'].'">'.$func_res['dev_Name'].' - '.$func_res['dev_LastIP'].'</a><br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div> ';
|
echo '</div> ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT "device_id", "net_device_name", "net_device_typ" FROM "network_infrastructure"';
|
$sql = 'SELECT "device_id", "net_device_name", "net_device_typ" FROM "network_infrastructure"';
|
||||||
$result = $db->query($sql);//->fetchArray(SQLITE3_ASSOC);
|
$result = $db->query($sql);//->fetchArray(SQLITE3_ASSOC);
|
||||||
?>
|
?>
|
||||||
@@ -163,8 +164,7 @@ while($res = $result->fetchArray(SQLITE3_ASSOC)){
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
<div class="tab-content">
|
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($res = $result->fetchArray(SQLITE3_ASSOC)){
|
while($res = $result->fetchArray(SQLITE3_ASSOC)){
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ function getDeviceData() {
|
|||||||
$mac = $deviceData['dev_MAC'];
|
$mac = $deviceData['dev_MAC'];
|
||||||
|
|
||||||
$deviceData['dev_Infrastructure'] = $row['dev_Infrastructure'];
|
$deviceData['dev_Infrastructure'] = $row['dev_Infrastructure'];
|
||||||
|
$deviceData['dev_Infrastructure_port'] = $row['dev_Infrastructure_port'];
|
||||||
$deviceData['dev_FirstConnection'] = formatDate ($row['dev_FirstConnection']); // Date formated
|
$deviceData['dev_FirstConnection'] = formatDate ($row['dev_FirstConnection']); // Date formated
|
||||||
$deviceData['dev_LastConnection'] = formatDate ($row['dev_LastConnection']); // Date formated
|
$deviceData['dev_LastConnection'] = formatDate ($row['dev_LastConnection']); // Date formated
|
||||||
|
|
||||||
@@ -155,6 +156,7 @@ function setDeviceData() {
|
|||||||
dev_Location = "'. quotes($_REQUEST['location']) .'",
|
dev_Location = "'. quotes($_REQUEST['location']) .'",
|
||||||
dev_Comments = "'. quotes($_REQUEST['comments']) .'",
|
dev_Comments = "'. quotes($_REQUEST['comments']) .'",
|
||||||
dev_Infrastructure = "'. quotes($_REQUEST['infrastructure']).'",
|
dev_Infrastructure = "'. quotes($_REQUEST['infrastructure']).'",
|
||||||
|
dev_Infrastructure_port = "'. quotes($_REQUEST['infrastructureport']).'",
|
||||||
dev_StaticIP = "'. quotes($_REQUEST['staticIP']) .'",
|
dev_StaticIP = "'. quotes($_REQUEST['staticIP']) .'",
|
||||||
dev_ScanCycle = "'. quotes($_REQUEST['scancycle']) .'",
|
dev_ScanCycle = "'. quotes($_REQUEST['scancycle']) .'",
|
||||||
dev_AlertEvents = "'. quotes($_REQUEST['alertevents']) .'",
|
dev_AlertEvents = "'. quotes($_REQUEST['alertevents']) .'",
|
||||||
|
|||||||
Reference in New Issue
Block a user