NewsNewsFeaturesDownloadsDevelopmentSupportForumDocumentsAbout Us

IpFormatRule 類別 參考文件
[Validator_Rules]

類別IpFormatRule的繼承圖:

RegExpRule Rule Validation Object 全部成員列表

公開方法(Public Methods)

 IpFormatRule ()
 validate ($value)

詳細描述

Returns true if a given IP address is in valid CIDR format (Classless Inter-Domain Routing) These addresses should have the following format:

xxx.yyy.zzz.www

where each one of the elements is an integer between 0 and 255.

定義在 ipformatrule.class.php 檔案之第 18 行.


建構子與解構子說明文件

IpFormatRule::IpFormatRule  ) 
 

Initializes the rule

定義在 ipformatrule.class.php 檔案之第 23 行.

參考 RegExpRule::RegExpRule().

00024         {
00025             $this->RegExpRule(IP_FORMAT_RULE_REG_EXP, false);
00026         }


函式成員說明文件

IpFormatRule::validate value  ) 
 

Retursn true if the given IP address is in valid CIDR format

參數:
value the IP address to validate

依據RegExpRule重新實作.

定義在 ipformatrule.class.php 檔案之第 33 行.

參考 Validation::_setError().

00034         {
00035             if (!ereg($this->_regExp, $value, $regs))
00036             {
00037                 $this->_setError(ERROR_RULE_IP_FORMAT_WRONG);
00038                 return false;
00039             }
00040             else if ($regs[1] > 255 || $regs[2] > 255 || $regs[3] > 255 || $regs[4] > 255)
00041             {
00042                 $this->_setError(ERROR_RULE_IP_FORMAT_WRONG);
00043                 return false;
00044             }
00045             else
00046             {
00047                 $this->_setError(false);
00048                 return true;
00049             }
00050         }


此類別(class) 文件是由下列檔案中產生: