apps/dvr_old/php/check.php

Go to the documentation of this file.
00001 <?php
00002 
00003     function checkMac ($mac)
00004     {
00005         $mac  = trim ($mac);
00006         $mac  = str_replace (" ", "", $mac);
00007         $mac  = str_replace (":", "", $mac);
00008         $mac  = trim ($mac);
00009         $mac  = str_pad ($mac, 12, "0", STR_PAD_LEFT);
00010         for ($i=0; $i<12; $i++)
00011         {
00012             if (! is_numeric ("0x0".$mac[$i]) ) return -1;
00013         }
00014         return $mac;
00015     }
00016 
00017     function getDottedMAC ($mac)
00018     {
00019         $mac_ = $mac[0].$mac[1];
00020         for ($i=2; $i<12; $i+=2)
00021         {
00022             $mac_ .= ":" . $mac[$i].$mac[$i+1];
00023         }
00024         return $mac_;
00025     }
00026     
00027 ?>
00028 

Generated on Fri Nov 28 00:06:21 2008 for elphel by  doxygen 1.5.1