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


PHP IPSLib::findIPAddresses方法代码示例

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


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

 /**
  * Learn about an IP address
  *
  * @access	private
  * @return	void		[Outputs to screen]
  */
 private function _learnIP()
 {
     if ($this->request['ip'] == "") {
         $this->_toolsIndex($this->lang->words['t_noip']);
     }
     $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);
     }
     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']);
     }
     //$this->DB->build( array( 'select'	=> 'member_id, members_display_name, email, posts, ip_address, joined',
     //								'from'	=> 'members',
     //								'where'	=> 'ip_address' . $query,
     //								'order'	=> 'joined DESC',
     //								'limit'	=> array( 250 )
     //					) 		);
     //$this->DB->execute();
     //while ( $m = $this->DB->fetch() )
     //{
     //	$m['_joined']	= ipsRegistry::getClass( 'class_localization')->getDate( $m['joined'], 'SHORT' );
     //
     //	$registered[]	= $m;
     //}
     //-----------------------------------------
     // 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['post_date'], 'SHORT');
             $posted[] = $m;
         }
         unset($results['posts']);
     }
     //$this->DB->build( array( 'select'	=> 'p.pid, p.author_id, p.post_date, p.ip_address, p.topic_id',
     //								'from'	=> array( 'posts' => 'p' ),
     //								'where'	=> 'p.ip_address' . $query,
     //								'group'	=> 'p.author_id',
     //								'order'	=> 'p.post_date DESC',
     //								'limit'	=> array( 250 ),
     //								'add_join'	=> array(
     //													array( 'select'	=> 'm.member_id, m.members_display_name, m.email, m.posts, m.joined',
     //															'from'	=> array( 'members' => 'm' ),
     //															'where'	=> 'm.member_id=p.author_id',
     //															'type'	=> 'left'
     //														)
     //													)
     //					)		);
     //$this->DB->execute();
     //while ( $m = $this->DB->fetch() )
     //{
     //	$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['post_date'], 'SHORT' );
     //
     //	$posted[]	= $m;
     //}
     //-----------------------------------------
     // 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'];
//.........这里部分代码省略.........
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:101,代码来源:tools.php


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