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


PHP IPAddress::get方法代码示例

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


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

示例1: vote

 public function vote($answer)
 {
     XDB::startTransaction();
     XDB::execute('INSERT INTO  qdj_votes
                           SET  qdj = {?}, uid = {?}, rank = 0, rule = "null"', $this->id(), S::user()->id());
     $vote = XDB::insertID();
     // Get the rank
     $rank = XDB::query('SELECT  COUNT(*)+1
                           FROM  qdj_votes
                          WHERE  qdj = {?} AND rank != 0', $this->id())->fetchOneCell();
     if ($rank == 1) {
         if ($this->writer === null) {
             $this->select(QDJSelect::all());
         }
         XDB::execute('INSERT INTO  qdj_votes
                               SET  qdj = {?}, uid = {?}, rank = 0, rule = 10', $this->id(), $this->writer->id());
     }
     $rule = null;
     switch ($rank) {
         case 1:
             $rule = '1';
             break;
         case 2:
             $rule = '2';
             break;
         case 3:
             $rule = '3';
             break;
         case 13:
             $rule = '4';
             break;
         case 42:
             $rule = '5';
             break;
         case 69:
             $rule = '6';
             break;
         case 314:
             $rule = '7';
             break;
         case substr(strrchr(IPAddress::get(), '.'), 1):
             $rule = '8';
             break;
         case date('d') + date('m'):
             $rule = '9';
             break;
     }
     XDB::execute('UPDATE qdj_votes
                      SET rank = {?}, rule = {?}
                    WHERE vote_id = {?}', $rank, $rule, $vote);
     XDB::commit();
     if ($answer == 1) {
         XDB::execute('UPDATE qdj SET count1 = count1+1 WHERE id={?}', $this->id());
     } else {
         XDB::execute('UPDATE qdj SET count2 = count2+1 WHERE id={?}', $this->id());
     }
 }
开发者ID:netixx,项目名称:frankiz,代码行数:57,代码来源:qdj.php

示例2: isRoomMaster

 /**
  * Is the current user a room master ?
  * @return boolean
  */
 public function isRoomMaster()
 {
     $user = S::user();
     if (!$user) {
         return false;
     }
     return $user->isWeb() || $user->hasRights($this, Rights::admin()) || $this->rooms()->ips()->has(IPAddress::get());
 }
开发者ID:netixx,项目名称:frankiz,代码行数:12,代码来源:group.php


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