summaryrefslogtreecommitdiffstats
path: root/ldap-site-mngmt/webinterface/syntax_check.php
diff options
context:
space:
mode:
authorTarik Gasmi2007-09-27 16:40:23 +0200
committerTarik Gasmi2007-09-27 16:40:23 +0200
commitecc473303fbee5f5466d2477157b5fd682357003 (patch)
tree2776e2d1d44543e60e15fba30d98d630a551c59c /ldap-site-mngmt/webinterface/syntax_check.php
parentAdded text to PXE image "please select" and "use arrow keys". Dirks idea. (diff)
downloadcore-ecc473303fbee5f5466d2477157b5fd682357003.tar.gz
core-ecc473303fbee5f5466d2477157b5fd682357003.tar.xz
core-ecc473303fbee5f5466d2477157b5fd682357003.zip
Reorganized LSM Webinterface
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1353 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'ldap-site-mngmt/webinterface/syntax_check.php')
-rw-r--r--ldap-site-mngmt/webinterface/syntax_check.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/ldap-site-mngmt/webinterface/syntax_check.php b/ldap-site-mngmt/webinterface/syntax_check.php
index 4784d6d3..5d714122 100644
--- a/ldap-site-mngmt/webinterface/syntax_check.php
+++ b/ldap-site-mngmt/webinterface/syntax_check.php
@@ -88,6 +88,42 @@ function check_netip_syntax($IP)
}
# MAC Adresse
+function check_mac_syntax($MAC)
+{
+ if($this->CLEAR) { $this->clear_error();}
+
+ $len = strlen($MAC);
+ if( $len != 17 ){
+ $this->ERROR = "check_mac_syntax: too long [$MAC][$len]";
+ return false;
+ }
+
+ $badcharacter = eregi_replace("([0-9a-fA-F\:]+)","",$MAC);
+ #echo "badcharacter: ".$badcharacter."<br>";
+ if(!empty($badcharacter)){
+ $this->ERROR = "check_mac_syntax: Bad data in MAC address [$badcharacter]";
+ return false;
+ }
+
+ $chunks = explode(":",$MAC);
+ #print_r($chunks)."<br>";
+ $count = count($chunks);
+ if ($count != 6){
+ $this->ERROR = "check_mac_syntax: not in format hx:hx:hx:hx:hx:hx [$MAC]";
+ return false;
+ }
+ foreach ($chunks as $chunk){
+ $chunklen = strlen($chunk);
+ if( $chunklen != 2 ){
+ $this->ERROR = "check_mac_syntax: too long [$MAC][$len]";
+ return false;
+ }
+ }
+
+ return true;
+
+}
+
# Domainname