diff --git a/include/functions.inc b/include/functions.inc
index 41a4bc310df07536d16dc0e42b3196af8465b337..ddb9e1465caa15c773d0e9bd1c572256ab62065a 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
"/</",
"/>/",
"/\?/",
- "/(\'|\")/");
+ "/\"/");
$to = array(
"%25",
}
+function mac2company($mac)
+{
+ $vendor= "";
+
+ /* Generate a normailzed mac... */
+ $mac= substr(preg_replace('/[:-]/', '', $mac), 0, 6);
+
+ /* Check for existance of the oui file */
+ if (!is_readable(CONFIG_DIR."/oui.txt")){
+ return ("");
+ }
+
+ /* Open file and look for mac addresses... */
+ $handle = @fopen(CONFIG_DIR."/oui.txt", "r");
+ if ($handle) {
+ while (!feof($handle)) {
+ $line = fgets($handle, 4096);
+
+ if (preg_match("/^$mac/i", $line)){
+ $vendor= substr($line, 32);
+ }
+ }
+ fclose($handle);
+ }
+
+ return ($vendor);
+}
+
+
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>