当前位置: 首页>>代码示例>>PHP>>正文


PHP IPSLib::validateIPv4方法代码示例

本文整理汇总了PHP中IPSLib::validateIPv4方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::validateIPv4方法的具体用法?PHP IPSLib::validateIPv4怎么用?PHP IPSLib::validateIPv4使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPSLib的用法示例。


在下文中一共展示了IPSLib::validateIPv4方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * Singleton init method
  *
  * @return	@e void
  */
 protected static function init()
 {
     if (self::$initiated !== TRUE) {
         //-----------------------------------------
         // IP Address
         //-----------------------------------------
         if (ipsRegistry::$settings['xforward_matching']) {
             //foreach( array_reverse( explode( ',', my_getenv('HTTP_X_FORWARDED_FOR') ) ) as $x_f ) // See http://community.invisionpower.com/resources/bugs.html/_/ip-board/multiple-ips-in-x-forwarded-for-r37844
             foreach (explode(',', my_getenv('HTTP_X_FORWARDED_FOR')) as $x_f) {
                 $addrs[] = trim($x_f);
             }
             $addrs[] = my_getenv('HTTP_CLIENT_IP');
             $addrs[] = my_getenv('HTTP_X_CLUSTER_CLIENT_IP');
             $addrs[] = my_getenv('HTTP_PROXY_USER');
         }
         $addrs[] = my_getenv('REMOTE_ADDR');
         //-----------------------------------------
         // Do we have one yet?
         //-----------------------------------------
         foreach ($addrs as $ip) {
             //-----------------------------------------
             // IP v4
             //-----------------------------------------
             if (IPSLib::validateIPv4($ip)) {
                 self::instance()->ip_address = $ip;
                 break;
             } else {
                 if (IPSLib::validateIPv6($ip)) {
                     self::instance()->ip_address = $ip;
                     break;
                 }
             }
         }
         //-----------------------------------------
         // Make sure we take a valid IP address
         //-----------------------------------------
         if (!self::instance()->ip_address and !isset($_SERVER['SHELL']) and $_SERVER['SESSIONNAME'] != 'Console') {
             if (!defined('IPS_IS_SHELL') or !IPS_IS_SHELL) {
                 print "Could not determine your IP address";
                 exit;
             }
         }
         //-----------------------------------------
         // Get user-agent, browser and OS
         //-----------------------------------------
         self::instance()->user_agent = IPSText::parseCleanValue(my_getenv('HTTP_USER_AGENT'));
         self::instance()->operating_system = self::_fetch_os();
         if (IPS_AREA == 'admin') {
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/session/adminSessions.php', 'adminSessions');
             /**
              * Support for extending the session class
              */
             if (is_file(IPS_ROOT_PATH . "sources/classes/session/ssoAdminSessions.php")) {
                 $classToLoadA = IPSLib::loadLibrary(IPS_ROOT_PATH . "sources/classes/session/ssoAdminSessions.php", 'ssoAdminSessions');
                 /**
                  * Does the ssoAdminSessions class exist?
                  */
                 if (class_exists($classToLoadA)) {
                     $parent = get_parent_class($classToLoadA);
                     /**
                      * Is it a child of adminSessions
                      */
                     if ($parent == $classToLoad) {
                         self::$session_class = new $classToLoadA();
                     } else {
                         self::$session_class = new $classToLoad();
                     }
                 }
             } else {
                 self::$session_class = new $classToLoad();
             }
         } else {
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/session/publicSessions.php', 'publicSessions');
             /**
              * Support for extending the session class
              */
             if (is_file(IPS_ROOT_PATH . "sources/classes/session/ssoPublicSessions.php")) {
                 $classToLoadA = IPSLib::loadLibrary(IPS_ROOT_PATH . "sources/classes/session/ssoPublicSessions.php", 'ssoPublicSessions');
                 /**
                  * Does the ssoPublicSessions class exist?
                  */
                 if (class_exists($classToLoadA)) {
                     $parent = get_parent_class($classToLoadA);
                     /**
                      * Is it a child of publicSessions
                      */
                     if ($parent == $classToLoad) {
                         self::$session_class = new $classToLoadA();
                     } else {
                         self::$session_class = new $classToLoad();
                     }
                 }
             } else {
                 self::$session_class = new $classToLoad();
             }
//.........这里部分代码省略.........
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:101,代码来源:ipsRegistry.php

示例2: __construct


//.........这里部分代码省略.........
                     return $this->_response(0, 'session_invalidmid');
                 } else {
                     //--------------------------------------------
                     // Member found, check passy
                     //--------------------------------------------
                     //if ( $session_data['session_member_login_key'] != self::$data_store['member_login_key'] )
                     //{
                     //	//--------------------------------------------
                     //	// Passys don't match..
                     //	//--------------------------------------------
                     //
                     //	return $this->_response( 0, 'Session member password mismatch' );
                     //}
                     //else
                     //{
                     //--------------------------------------------
                     // Do we have admin access?
                     //--------------------------------------------
                     if (self::$data_store['g_access_cp'] != 1) {
                         return $this->_response(0, 'session_noaccess');
                     } else {
                         $this->_validated = TRUE;
                     }
                     //}
                 }
             }
         }
     }
     //--------------------------------------------
     // If we're here, we're valid...
     //--------------------------------------------
     if ($this->_validated === TRUE) {
         if ($session_data['session_running_time'] < time() - $_time_out_mins * 60) {
             self::$data_store = array();
             self::setMember(0);
             $this->_validated = FALSE;
             return $this->_response(0, 'session_timeout');
         } else {
             if (IPB_ACP_IP_MATCH) {
                 if ($session_data['session_ip_address'] != self::instance()->ip_address or !IPSLib::validateIPv4($session_data['session_ip_address']) and !IPSLib::validateIPv6($session_data['session_ip_address']) or !IPSLib::validateIPv4(self::instance()->ip_address) and !IPSLib::validateIPv6(self::instance()->ip_address)) {
                     self::$data_store = array();
                     self::setMember(0);
                     $this->_validated = FALSE;
                     return $this->_response(0, 'session_mismatchip');
                 }
             }
         }
         self::setMember(self::$data_store['member_id']);
         //-----------------------------------------
         // Fix up secondary groups
         //-----------------------------------------
         if (self::$data_store['mgroup_others']) {
             $groups_id = explode(',', self::$data_store['mgroup_others']);
             $masks = array();
             $cache = ipsRegistry::cache()->getCache('group_cache');
             if (count($groups_id)) {
                 foreach ($groups_id as $pid) {
                     if (empty($cache[$pid]['g_id'])) {
                         continue;
                     }
                     //-----------------------------------------
                     // Got masks?
                     //-----------------------------------------
                     if ($cache[$pid]['g_perm_id']) {
                         self::$data_store['g_perm_id'] .= ',' . $cache[$pid]['g_perm_id'];
                     }
                 }
             }
         }
         //-----------------------------------------
         // Current Location, used for online list
         //-----------------------------------------
         $module = ipsRegistry::$request['module'] != 'ajax' ? ipsRegistry::$request['module'] : $session_data['session_location'];
         $location = $session_data['session_url'];
         if (IPS_APP_COMPONENT && ipsRegistry::$request['module'] != 'ajax') {
             $location = str_ireplace("login=yes", "", ipsRegistry::$settings['query_string_safe']);
             $location = ltrim($location, '?');
             $location = preg_replace("!adsess=(\\w){32}!", "", $location);
             $location = preg_replace("!&mshow=(.+?)*!i", "", $location);
             $location = preg_replace("!&st=(.+?)*!i", "", $location);
             $location = preg_replace("!&messageinabottleacp=(.+?)*!i", "", $location);
         }
         /* Compare user-agent stuff */
         $session_data['_session_app_data'] = unserialize($session_data['session_app_data']);
         if (is_array($session_data['_session_app_data']) and $session_data['_session_app_data']['uagent_key']) {
             if ($session_data['_session_app_data']['uagent_raw'] != self::instance()->user_agent) {
                 $session_data['_session_app_data'] = self::_processUserAgent();
                 $session_data['_session_app_data']['uagent_raw'] = self::instance()->user_agent;
             }
         } else {
             $session_data['_session_app_data'] = self::_processUserAgent();
             $session_data['_session_app_data']['uagent_raw'] = self::instance()->user_agent;
         }
         //-----------------------------------------
         // Done...
         //-----------------------------------------
         $this->DB->update('core_sys_cp_sessions', array('session_running_time' => time(), 'session_location' => $module, 'session_url' => $location, 'session_app_data' => serialize($session_data['_session_app_data']), 'session_member_name' => self::$data_store['members_display_name']), 'session_member_id=' . intval(self::$data_store['member_id']) . " and session_id='" . ipsRegistry::$request['adsess'] . "'");
         return $this->_response(1, '', $session_data['_session_app_data']);
     }
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:101,代码来源:adminSessions.php

示例3: init

 /**
  * Our singleton INIT function
  *
  * @access	protected
  * @return	@e void
  */
 protected static function init()
 {
     if (self::$initiated !== TRUE) {
         //-----------------------------------------
         // IP Address
         //-----------------------------------------
         if (ipsRegistry::$settings['xforward_matching']) {
             foreach (array_reverse(explode(',', my_getenv('HTTP_X_FORWARDED_FOR'))) as $x_f) {
                 $addrs[] = trim($x_f);
             }
             $addrs[] = my_getenv('HTTP_CLIENT_IP');
             $addrs[] = my_getenv('HTTP_X_CLUSTER_CLIENT_IP');
             $addrs[] = my_getenv('HTTP_PROXY_USER');
         }
         $addrs[] = my_getenv('REMOTE_ADDR');
         //-----------------------------------------
         // Do we have one yet?
         //-----------------------------------------
         foreach ($addrs as $ip) {
             //-----------------------------------------
             // IP v4
             //-----------------------------------------
             if (IPSLib::validateIPv4($ip)) {
                 self::instance()->ip_address = $ip;
                 break;
             } else {
                 if (IPSLib::validateIPv6($ip)) {
                     self::instance()->ip_address = $ip;
                     break;
                 }
             }
         }
         //-----------------------------------------
         // Make sure we take a valid IP address
         //-----------------------------------------
         if (!self::instance()->ip_address and !isset($_SERVER['SHELL']) and $_SERVER['SESSIONNAME'] != 'Console') {
             print "Could not determine your IP address";
             exit;
         }
         if (IPS_IS_UPGRADER) {
             require_once IPS_ROOT_PATH . "setup/sources/classes/session/sessions.php";
             /*noLibHook*/
             self::$session_class = new sessions();
         } else {
             self::setMember(0);
         }
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:54,代码来源:ipsRegistry_setup.php

示例4: set

 /**
  * Set a cookie.
  *
  * Abstract layer allows us to do some checking, etc
  *
  * @param	string		Cookie name
  * @param	string		Cookie value
  * @param	integer		Is sticky flag
  * @param	integer		Number of days to expire cookie in
  * @param	bool		If false, will set a cookie on the entire domain
  * @param	bool		If $local is false, controls if the cookie prefix should be used
  * @return	@e void
  * @since	2.0
  */
 public static function set($name, $value = "", $sticky = 1, $expires_x_days = 0, $local = TRUE, $usePrefix = FALSE)
 {
     //-----------------------------------------
     // Check
     //-----------------------------------------
     if (!empty(ipsRegistry::$settings['no_print_header'])) {
         return;
     }
     /* Update internal array */
     self::$_cookiesSet[$name] = $value;
     //-----------------------------------------
     // Auto serialize arrays
     //-----------------------------------------
     if (is_array($value)) {
         $value = json_encode($value);
     }
     //-----------------------------------------
     // Set vars
     //-----------------------------------------
     if ($sticky == 1) {
         $expires = time() + 60 * 60 * 24 * 365;
     } else {
         if ($expires_x_days) {
             $expires = time() + $expires_x_days * 86400;
         } else {
             $expires = FALSE;
         }
     }
     //-----------------------------------------
     // Finish up...
     //-----------------------------------------
     ipsRegistry::$settings['cookie_domain'] = ipsRegistry::$settings['cookie_domain'] == "" ? "" : ipsRegistry::$settings['cookie_domain'];
     ipsRegistry::$settings['cookie_path'] = ipsRegistry::$settings['cookie_path'] == "" ? "/" : ipsRegistry::$settings['cookie_path'];
     $_name = (($local or $usePrefix) ? ipsRegistry::$settings['cookie_id'] : '') . $name;
     $_path = $local ? ipsRegistry::$settings['cookie_path'] : '/';
     if ($local or substr(ipsRegistry::$settings['cookie_domain'], 0, 1) === '.') {
         $_domain = ipsRegistry::$settings['cookie_domain'];
     } else {
         $parsedUrl = parse_url(ipsRegistry::$settings['board_url']);
         /* Test to make sure we're not using an IP address or hostname (such as localhost, etc) */
         if (!strstr($parsedUrl['host'], '.') || IPSLib::validateIPv4($parsedUrl['host']) || IPSLib::validateIPv4($parsedUrl['host'])) {
             $_domain = '';
         } else {
             $_domain = array();
             foreach (array_reverse(explode('.', $parsedUrl['host'])) as $bit) {
                 $_domain[] = $bit;
                 if (!in_array($bit, array('aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov', 'info', 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org', 'pro', 'tel', 'travel', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bl', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'eh', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'um', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'yu', 'za', 'zm', 'zw'))) {
                     break;
                 }
             }
             $_domain = '.' . implode('.', array_reverse($_domain));
         }
     }
     //-----------------------------------------
     // Set the cookie
     //-----------------------------------------
     if (in_array($name, self::$sensitive_cookies)) {
         if (PHP_VERSION < 5.2) {
             if (ipsRegistry::$settings['cookie_domain']) {
                 @setcookie($_name, $value, $expires, $_path, $_domain . '; HttpOnly');
             } else {
                 @setcookie($_name, $value, $expires, $_path);
             }
         } else {
             @setcookie($_name, $value, $expires, $_path, $_domain, NULL, TRUE);
         }
     } else {
         @setcookie($_name, $value, $expires, $_path, $_domain);
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:84,代码来源:core.php

示例5: authenticate


//.........这里部分代码省略.........
     $url = $this->connectConfig['master_url'] . '?' . http_build_query($send);
     $return = $this->cfm->getFileContents($url);
     $data = @json_decode($return, TRUE);
     if (!isset($data['connect_status']) or !$data['connect_status']) {
         $this->return_code = 'WRONG_AUTH';
         return false;
     }
     //-----------------------------------------
     // If unsuccessful, return
     //-----------------------------------------
     if ($data['connect_status'] != 'SUCCESS') {
         $this->return_code = $data['connect_status'];
         if ($this->return_code == 'ACCOUNT_LOCKED') {
             $this->account_unlock = $data['connect_unlock'];
             /* @link http://community.invisionpower.com/resources/bugs.html/_/ip-board/ipsconnect-account-unlock-time-r40812 */
             if ($data['connect_unlock_period']) {
                 $this->settings['ipb_bruteforce_period'] = $data['connect_unlock_period'];
             }
         }
         if ($this->return_code == 'VALIDATING') {
             $this->revalidate_url = $data['connect_revalidate_url'];
         }
         return false;
     }
     //-----------------------------------------
     // Create or update member accordingly
     //-----------------------------------------
     $update = array();
     $this->member_data = IPSMember::load($data['connect_id'], 'all', 'ipsconnect');
     if (!isset($this->member_data['member_id']) and isset($_member['member_id'])) {
         $this->member_data = $_member;
         $update['ipsconnect_id'] = $data['connect_id'];
     }
     if (!isset($this->member_data['member_id'])) {
         if (IPSText::mbstrlen($data['connect_username']) > ipsRegistry::$settings['max_user_name_length']) {
             $data['connect_username'] = IPSText::mbsubstr($data['connect_username'], 0, ipsRegistry::$settings['max_user_name_length']);
         }
         $this->member_data = $this->createLocalMember(array('members' => array('name' => $data['connect_username'], 'members_display_name' => $data['connect_displayname'], 'email' => $email_address, 'password' => $password, 'ipsconnect_id' => $data['connect_id'])));
     } else {
         if ($this->member_data['name'] != $data['connect_username'] and !defined('CONNECT_NOSYNC_NAMES')) {
             $update['name'] = $data['connect_username'];
         }
         if ($this->member_data['members_display_name'] != $data['connect_displayname'] and !defined('CONNECT_NOSYNC_NAMES')) {
             $update['members_display_name'] = $data['connect_displayname'];
         }
         if ($this->member_data['email'] != $data['connect_email']) {
             $update['email'] = $data['connect_email'];
         }
         IPSMember::updatePassword($this->member_data['member_id'], md5($password));
     }
     //-----------------------------------------
     // Privacy
     //-----------------------------------------
     $privacy = $this->member_data['g_hide_online_list'] || empty($this->settings['disable_anonymous']) && !empty($this->request['anonymous']) ? 1 : 0;
     $update['login_anonymous'] = intval($privacy) . '&1';
     //-----------------------------------------
     // Update
     //-----------------------------------------
     if (!empty($update)) {
         IPSMember::save($this->member_data['member_id'], array('members' => $update));
     }
     //-----------------------------------------
     // If this is ACP or cross domain, just log in without SSO
     // http://community.invisionpower.com/resources/bugs.html/_/ip-board/cross-domain-connect-logins-r41932
     //-----------------------------------------
     $local = strtolower(@parse_url($this->settings['board_url'], PHP_URL_HOST));
     $connect = strtolower(@parse_url($this->connectConfig['master_url'], PHP_URL_HOST));
     if (strstr($local, '.') && !IPSLib::validateIPv4($local)) {
         $_domain = array();
         foreach (array_reverse(explode('.', $local)) as $bit) {
             $_domain[] = $bit;
             if (!in_array($bit, array('aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov', 'info', 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org', 'pro', 'tel', 'travel', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bl', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'eh', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'um', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'yu', 'za', 'zm', 'zw'))) {
                 break;
             }
         }
         $local = '.' . implode('.', array_reverse($_domain));
     }
     if (strstr($connect, '.') && !IPSLib::validateIPv4($connect)) {
         $_domain = array();
         foreach (array_reverse(explode('.', $connect)) as $bit) {
             $_domain[] = $bit;
             if (!in_array($bit, array('aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov', 'info', 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org', 'pro', 'tel', 'travel', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bl', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'eh', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'um', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'yu', 'za', 'zm', 'zw'))) {
                 break;
             }
         }
         $connect = '.' . implode('.', array_reverse($_domain));
     }
     if ($this->is_admin_auth or $this->is_password_check or $local != $connect) {
         $this->return_code = 'SUCCESS';
         return;
     }
     //-----------------------------------------
     // And redirect to log us in centrally
     //-----------------------------------------
     $redirect = $this->request['referer'] ? $this->request['referer'] : $this->settings['board_url'];
     if (strpos($redirect, '?') === FALSE) {
         $redirect .= '?';
     }
     $this->registry->output->silentRedirect($url . '&noparams=1&redirect=' . base64_encode($redirect) . '&redirectHash=' . md5($this->connectConfig['master_key'] . base64_encode($redirect)));
 }
开发者ID:mover5,项目名称:imobackup,代码行数:101,代码来源:auth.php


注:本文中的IPSLib::validateIPv4方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。