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


PHP Authenticator::acctStop方法代码示例

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


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

示例1: acctStop

 /**
  * Final update and stop accounting
  *
  * @param string $conn_id The connection id (the token id) for the
  *                        connection to work on
  * @param string $errmsg  Reference of error message
  *
  * @return bool Returns always true
  */
 public function acctStop($conn_id, &$errmsg = null)
 {
     // Call parent method
     parent::acctStop($conn_id);
     return true;
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:15,代码来源:AuthenticatorLocalUser.php

示例2: acctStop

 /**
  * Final update and stop accounting
  *
  * @param string $conn_id The connection id (the token id) for the
  *                        connection to work on
  * @param string $errmsg  Reference of error message
  *
  * @return bool Returns whether successful or not
  */
 function acctStop($conn_id, &$errmsg = null)
 {
     // Call parent method
     parent::acctStop($conn_id);
     $db = AbstractDb::getObject();
     // Init values
     $info = null;
     $conn_id = $db->escapeString($conn_id);
     if (Dependency::check("Auth_RADIUS", $errmsg)) {
         $db->execSqlUniqueRes("SELECT CURRENT_TIMESTAMP, *, CASE WHEN ((CURRENT_TIMESTAMP - reg_date) > networks.validation_grace_time) THEN true ELSE false END AS validation_grace_time_expired FROM connections JOIN users ON (users.user_id=connections.user_id) JOIN networks ON (users.account_origin = networks.network_id) WHERE connections.conn_id={$conn_id}", $info, false);
         // RADIUS accounting stop
         // Session is completely based on Database time
         $session_time = strtotime($info['now']) - strtotime($info['timestamp_in']);
         $radius_acct = new Auth_RADIUS_Acct_Stop();
         $radius_acct->addServer($this->mRadius_hostname, $this->mRadius_acct_port, $this->mRadius_secret_key);
         // Specify the user for which accounting will be done
         $radius_acct->username = $info['username'];
         $racct->session_time = $session_time;
         // Set the session ID to the generated token
         $radius_acct->session_id = $info['token'];
         $status = $radius_acct->start();
         if (PEAR::isError($status)) {
             $errmsg = "Could not initiate PEAR RADIUS class.";
             return false;
         }
         // Cause of session termination
         $radius_acct->putAttribute(RADIUS_ACCT_TERMINATE_CAUSE, RADIUS_TERM_SESSION_TIMEOUT);
         $result = $radius_acct->send();
         if (PEAR::isError($result)) {
             $errmsg = "Could not send accounting request to RADIUS server.";
             return false;
         } else {
             if ($result !== true) {
                 $radius_acct->close();
                 $errmsg = "Accounting request rejected by RADIUS server.";
                 return false;
             }
         }
         $radius_acct->close();
         return true;
     } else {
         return false;
     }
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:53,代码来源:AuthenticatorRadius.php


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