本文整理匯總了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));
}
示例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;
}
}
示例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));
}
}
示例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;
}
}
示例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));
}