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


PHP IPSLib::validateIPv6方法代码示例

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


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

示例1: _learnIP

 /**
  * Learn about an IP address
  *
  * @return	@e void		[Outputs to screen]
  */
 protected function _learnIP()
 {
     if ($this->request['ip'] == "") {
         $this->_toolsIndex($this->lang->words['t_noip']);
         return false;
     }
     $ip = trim($this->request['ip']);
     $resolved = $this->lang->words['t_partip'];
     $exact = 0;
     if (substr_count($ip, '.') == 3) {
         $exact = 1;
     }
     if (strstr($ip, '*')) {
         $exact = 0;
         $ip = str_replace("*", "", $ip);
     }
     //-----------------------------------------
     // Warning...ipv6 doesn't tend to resolve properly on
     // some Windows machines - this seems to be an OS limitation
     //-----------------------------------------
     if (IPSLib::validateIPv6($ip) == true) {
         $exact = 1;
     }
     if ($exact == 1) {
         $resolved = @gethostbyaddr($ip);
         $query = "='" . $ip . "'";
     } else {
         $query = " LIKE '" . $ip . "%'";
     }
     $results = IPSLib::findIPAddresses($query);
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $registered = array();
     $posted = array();
     $voted = array();
     $emailed = array();
     $validating = array();
     //-----------------------------------------
     // Find registered members
     //-----------------------------------------
     if (count($results['members'])) {
         foreach ($results['members'] as $m) {
             $m['_joined'] = ipsRegistry::getClass('class_localization')->getDate($m['joined'], 'SHORT');
             $registered[] = $m;
         }
         unset($results['members']);
     }
     //-----------------------------------------
     // Find Names POSTED under
     //-----------------------------------------
     if (count($results['posts'])) {
         foreach ($results['posts'] as $m) {
             $m['members_display_name'] = $m['members_display_name'] ? $m['members_display_name'] : $this->lang->words['t_guest'];
             $m['email'] = $m['email'] ? $m['email'] : $this->lang->words['t_notavail'];
             $m['_post_date'] = ipsRegistry::getClass('class_localization')->getDate($m['date'], 'SHORT');
             $posted[] = $m;
         }
         unset($results['posts']);
     }
     //-----------------------------------------
     // Find Names VOTED under
     //-----------------------------------------
     if (count($results['voters'])) {
         foreach ($results['voters'] as $m) {
             $m['members_display_name'] = $m['members_display_name'] ? $m['members_display_name'] : $this->lang->words['t_guest'];
             $m['email'] = $m['email'] ? $m['email'] : $this->lang->words['t_notavail'];
             $m['_vote_date'] = ipsRegistry::getClass('class_localization')->getDate($m['date'], 'SHORT');
             $voted[] = $m;
         }
         unset($results['voters']);
     }
     //-----------------------------------------
     // Find Names VALIDATING under
     //-----------------------------------------
     if (count($results['validating'])) {
         foreach ($results['validating'] as $m) {
             $m['members_display_name'] = $m['members_display_name'] ? $m['members_display_name'] : $this->lang->words['t_guest'];
             $m['email'] = $m['email'] ? $m['email'] : $this->lang->words['t_notavail'];
             $m['_entry_date'] = ipsRegistry::getClass('class_localization')->getDate($m['date'], 'SHORT');
             $validating[] = $m;
         }
         unset($results['validating']);
     }
     //-----------------------------------------
     // And output
     //-----------------------------------------
     $this->registry->output->html .= $this->html->learnIPResults($resolved, $registered, $posted, $voted, $emailed, $validating, $results);
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:94,代码来源:tools.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

 /**
  * 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

示例4: 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


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