mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-22 07:30:23 +00:00
Added function validateMac()
This commit is contained in:
parent
c594b8f4a9
commit
effa38c0a0
1 changed files with 17 additions and 0 deletions
|
@ -780,6 +780,23 @@ function validate_host($host)
|
||||||
return preg_match('/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i', $host);
|
return preg_match('/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i', $host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a MAC address
|
||||||
|
*
|
||||||
|
* @param string $mac
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function validateMac($mac) {
|
||||||
|
$macAddress = strtoupper(preg_replace('/[^a-fA-F0-9]/', '', $mac));
|
||||||
|
if (strlen($macAddress) !== 12) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!ctype_xdigit($macAddress)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Gets night mode toggle value
|
// Gets night mode toggle value
|
||||||
// @return boolean
|
// @return boolean
|
||||||
function getNightmode()
|
function getNightmode()
|
||||||
|
|
Loading…
Reference in a new issue