當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wfCheckEntropy函數代碼示例

本文整理匯總了PHP中wfCheckEntropy函數的典型用法代碼示例。如果您正苦於以下問題:PHP wfCheckEntropy函數的具體用法?PHP wfCheckEntropy怎麽用?PHP wfCheckEntropy使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wfCheckEntropy函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: wfResetSessionID

/**
 * Reset the session_id
 *
 * @since 1.22
 */
function wfResetSessionID()
{
    global $wgCookieSecure;
    $oldSessionId = session_id();
    $cookieParams = session_get_cookie_params();
    if (wfCheckEntropy() && $wgCookieSecure == $cookieParams['secure']) {
        session_regenerate_id(false);
    } else {
        $tmp = $_SESSION;
        session_destroy();
        wfSetupSession(MWCryptRand::generateHex(32));
        $_SESSION = $tmp;
    }
    $newSessionId = session_id();
    Hooks::run('ResetSessionID', array($oldSessionId, $newSessionId));
}
開發者ID:D66Ha,項目名稱:mediawiki,代碼行數:21,代碼來源:GlobalFunctions.php

示例2: renewSessionId

 /**
  * Renew the user's session id, using strong entropy
  */
 private function renewSessionId()
 {
     global $wgSecureLogin, $wgCookieSecure;
     if ($wgSecureLogin && !$this->mStickHTTPS) {
         $wgCookieSecure = false;
     }
     // If either we don't trust PHP's entropy, or if we need
     // to change cookie settings when logging in because of
     // wpStickHTTPS, then change the session ID manually.
     $cookieParams = session_get_cookie_params();
     if (wfCheckEntropy() && $wgCookieSecure == $cookieParams['secure']) {
         session_regenerate_id(false);
     } else {
         $tmp = $_SESSION;
         session_destroy();
         wfSetupSession(MWCryptRand::generateHex(32));
         $_SESSION = $tmp;
     }
 }
開發者ID:mangowi,項目名稱:mediawiki,代碼行數:22,代碼來源:SpecialUserlogin.php

示例3: wfFixSessionID

/**
 * Override session_id before session startup if php's built-in
 * session generation code is not secure.
 */
function wfFixSessionID()
{
    // If the cookie or session id is already set we already have a session and should abort
    if (isset($_COOKIE[session_name()]) || session_id()) {
        return;
    }
    // PHP's built-in session entropy is enabled if:
    // - entropy_file is set or you're on Windows with php 5.3.3+
    // - AND entropy_length is > 0
    // We treat it as disabled if it doesn't have an entropy length of at least 32
    $entropyEnabled = wfCheckEntropy();
    // If built-in entropy is not enabled or not sufficient override php's built in session id generation code
    if (!$entropyEnabled) {
        wfDebug(__METHOD__ . ": PHP's built in entropy is disabled or not sufficient, overriding session id generation using our cryptrand source.\n");
        session_id(MWCryptRand::generateHex(32));
    }
}
開發者ID:mangowi,項目名稱:mediawiki,代碼行數:21,代碼來源:GlobalFunctions.php

示例4: renewSessionId

 /**
  * Renew the user's session id, using strong entropy
  */
 private function renewSessionId()
 {
     if (wfCheckEntropy()) {
         session_regenerate_id(false);
     } else {
         //If we don't trust PHP's entropy, we have to replace the session manually
         $tmp = $_SESSION;
         session_unset();
         session_write_close();
         session_id(MWCryptRand::generateHex(32));
         session_start();
         $_SESSION = $tmp;
     }
 }
開發者ID:slackfaith,項目名稱:deadbrain_site,代碼行數:17,代碼來源:SpecialUserlogin.php

示例5: wfResetSessionID

/**
 * Reset the session_id
 *
 * Backported from MW 1.22
 */
function wfResetSessionID()
{
    global $wgCookieSecure;
    $oldSessionId = session_id();
    $cookieParams = session_get_cookie_params();
    if (wfCheckEntropy() && $wgCookieSecure == $cookieParams['secure']) {
        session_regenerate_id(true);
        // Wikia - $delete_old_session = true
    } else {
        $tmp = $_SESSION;
        session_destroy();
        wfSetupSession(MWCryptRand::generateHex(32));
        $_SESSION = $tmp;
    }
    $newSessionId = session_id();
    Hooks::run('ResetSessionID', array($oldSessionId, $newSessionId));
    wfDebug(sprintf("%s: new ID is '%s'\n", __METHOD__, $newSessionId));
}
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:23,代碼來源:GlobalFunctions.php


注:本文中的wfCheckEntropy函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。