mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
dev details refactoring v0.2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
deviceIP = getDeviceDataByMacAddress_NEW("<?php echo $_REQUEST["mac"]?>", "dev_LastIP")
|
||||
deviceIP = getDeviceDataByMacAddress("<?php echo $_REQUEST["mac"]?>", "dev_LastIP")
|
||||
</script>
|
||||
|
||||
<?php if ($_REQUEST["mac"] == "Internet") { ?>
|
||||
|
||||
@@ -486,39 +486,39 @@ function navigateToDeviceWithIp (ip) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
function getNameByMacAddress(macAddress) {
|
||||
return getDeviceDataByMacAddress(macAddress, "name")
|
||||
return getDeviceDataByMacAddress(macAddress, "dev_Name")
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// function getDeviceDataByMacAddress(macAddress, property) {
|
||||
|
||||
// const sessionDataKey = 'devicesListAll';
|
||||
// const sessionData = sessionStorage.getItem(sessionDataKey);
|
||||
|
||||
// if (!sessionData) {
|
||||
// console.log(`Session variable "${sessionDataKey}" not found.`);
|
||||
// return "Unknown";
|
||||
// }
|
||||
|
||||
// const devices = JSON.parse(sessionData);
|
||||
|
||||
// for (const device of devices) {
|
||||
// if (device.mac === macAddress) {
|
||||
// if ( device.mac == 'd2:a4:1a:74:ae:86')
|
||||
// {
|
||||
// console.log(device)
|
||||
// }
|
||||
|
||||
// return device[property];
|
||||
// }
|
||||
// }
|
||||
|
||||
// return "Unknown"; // Return a default value if MAC address is not found
|
||||
// }
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
function getDeviceDataByMacAddress(macAddress, property) {
|
||||
|
||||
const sessionDataKey = 'devicesListAll';
|
||||
const sessionData = sessionStorage.getItem(sessionDataKey);
|
||||
|
||||
if (!sessionData) {
|
||||
console.log(`Session variable "${sessionDataKey}" not found.`);
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
const devices = JSON.parse(sessionData);
|
||||
|
||||
for (const device of devices) {
|
||||
if (device.mac === macAddress) {
|
||||
if ( device.mac == 'd2:a4:1a:74:ae:86')
|
||||
{
|
||||
console.log(device)
|
||||
}
|
||||
|
||||
return device[property];
|
||||
}
|
||||
}
|
||||
|
||||
return "Unknown"; // Return a default value if MAC address is not found
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
function getDeviceDataByMacAddress_NEW(macAddress, property) {
|
||||
|
||||
const sessionDataKey = 'devicesListAll_JSON';
|
||||
const sessionData = sessionStorage.getItem(sessionDataKey);
|
||||
|
||||
@@ -529,9 +529,11 @@ function getDeviceDataByMacAddress_NEW(macAddress, property) {
|
||||
|
||||
const devices = JSON.parse(sessionData);
|
||||
|
||||
console.log(devices)
|
||||
|
||||
for (const device of devices) {
|
||||
if (device.mac === macAddress) {
|
||||
if ( device.mac == 'd2:a4:1a:74:ae:86')
|
||||
if (device["dev_MAC"].toLowerCase() === macAddress.toLowerCase()) {
|
||||
if ( device["dev_MAC"].toLowerCase() == 'd2:a4:1a:74:ae:86')
|
||||
{
|
||||
console.log(device)
|
||||
}
|
||||
|
||||
0
front/php/server/nslookup.php
Normal file → Executable file
0
front/php/server/nslookup.php
Normal file → Executable file
Reference in New Issue
Block a user