Commit 10db0a55 authored by Leo Leung's avatar Leo Leung
Browse files

Fixed bad handling of mac addresses

parent c9c1ed05
......@@ -35,14 +35,14 @@ class MacLookup
private function isValidMacAddress($input)
{
// 00:00:00:00:00:00
$input = str_replace(['-', ':', ' '], '', $input);
$input = str_replace(['-', ':', '.', ' '], '', $input);
$input = strtoupper($input);
if (strlen($input) != 12) {
return false;
}
return (preg_match('/([a-fA-F0-9]{2}[:|\-]?){6}/', $input) == 1);
return (preg_match('/([a-fA-F0-9]{2}){6}/', $input) == 1);
}
/**
......@@ -53,7 +53,7 @@ class MacLookup
private function process_mac_address($mac_address)
{
$mac_address = trim($mac_address);
$mac_address = str_replace(['-', ':', ' '], '', $mac_address);
$mac_address = str_replace(['-', ':', '.', ' '], '', $mac_address);
$mac_address = strtoupper($mac_address);
$data = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment