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


PHP Output::formatIP方法代码示例

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


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

示例1: get_csr_details

function get_csr_details($person, $auth_key)
{
    $csr = get_csr_from_db_raw($person->getX509ValidCN(), $auth_key);
    $subj = openssl_csr_get_subject($csr['csr'], false);
    $result = array('auth_token' => $csr['auth_key'], 'length' => csr_pubkey_length($csr['csr']), 'uploaded' => $csr['uploaded_date'], 'from_ip' => Output::formatIP($csr['from_ip'], true));
    foreach ($subj as $key => $value) {
        $result[$key] = $value;
    }
    return $result;
}
开发者ID:henrikau,项目名称:confusa,代码行数:10,代码来源:csr_lib.php

示例2: getFromDB

 /**
  * getFromDB() find one (or all) CSR(s) for a person in the database.
  *
  * @param	uid		$person limit the query to the person's common-name
  * @param	String|null	$pubHash the hash of the public key
  * @return	CSR|False	The CSR for the person
  * @access	public
  */
 static function getFromDB($uid, $pubHash)
 {
     $res = false;
     if (!isset($uid) || !isset($pubHash)) {
         return false;
     }
     $query = "SELECT * FROM csr_cache WHERE ";
     $query .= "auth_key=:auth_key AND ";
     $query .= "common_name=:common_name";
     $data = array();
     $data['auth_key'] = $pubHash;
     $data['common_name'] = $uid;
     try {
         $csr_res = MDB2Wrapper::execute($query, null, $data);
         if (count($csr_res) != 1) {
             return false;
         }
     } catch (DBStatementException $dbse) {
         Logger::log_event(LOG_WARNING, __FILE__ . ":" . __LINE__ . "cannot retrieve CSR from DB. Server said: " . $dbse->getMessage());
         return false;
     } catch (DBQueryException $dbqe) {
         Logger::log_event(LOG_WARNING, __FILE__ . ":" . __LINE__ . "cannot retrieve CSR from DB. Server said: " . $dbse->getMessage());
         return false;
     }
     $csr_type = $csr_res[0]['type'];
     if ($csr_type == CSR_PKCS10::getCSRType()) {
         $csr = new CSR_PKCS10($csr_res[0]['csr']);
     } else {
         if ($csr_type == CSR_SPKAC::getCSRType()) {
             $csr = new CSR_SPKAC($csr_res[0]['csr']);
         } else {
             throw new CryptoElementException("Unsupported CSR type " . $csr_type . "!");
         }
     }
     $csr->setUploadedDate($csr_res[0]['uploaded_date']);
     $csr->setUploadedFromIP(Output::formatIP($csr_res[0]['from_ip'], true));
     if ($csr->getAuthToken() !== $pubHash) {
         Logger::log_event(LOG_ALERT, "Found CSR in database with hash {$pubHash} but " . "this does not correspond to pubkey. Corrupted db?");
         return false;
     }
     return $csr;
 }
开发者ID:henrikau,项目名称:confusa,代码行数:50,代码来源:CSR.php


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