Devices: Prevent duplicate username within domain (if device assigned to a domain) or globally (if domain set to Global).

Functions: Added is_mac() and format_mac() functions.
This commit is contained in:
Nate Jones
2015-05-04 20:07:51 +00:00
parent 2205cf4fb7
commit 0acd0922ff
3 changed files with 124 additions and 49 deletions

View File

@@ -1266,4 +1266,22 @@ function number_pad($number,$n) {
}
}
//mac detection
if (!function_exists('is_mac')) {
function is_mac($str) {
return (preg_match('/([a-fA-F0-9]{2}[:|\-]?){6}/', $str) == 1) ? true : false;
}
}
//format mac address
if (!function_exists('format_mac')) {
function format_mac($str, $delim = '-', $case = 'lower') {
if (is_mac($str)) {
$str = join($delim, str_split($str, 2));
$str = ($case == 'upper') ? strtoupper($str) : strtolower($str);
}
return $str;
}
}
?>