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


PHP PMA_Config::getCookiePath方法代码示例

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


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

示例1: header

    // (do not use & for parameters sent by header)
    header('Location: ' . (defined('PMA_SETUP') ? '../' : '') . 'error.php' . '?lang=' . urlencode($available_languages[$lang][2]) . '&dir=' . urlencode($text_dir) . '&type=' . urlencode($strError) . '&error=' . urlencode(sprintf($strCantLoad, 'session')));
    exit;
} elseif (ini_get('session.auto_start') == true && session_name() != 'phpMyAdmin') {
    $_SESSION = array();
    if (isset($_COOKIE[session_name()])) {
        PMA_removeCookie(session_name());
    }
    session_unset();
    @session_destroy();
}
// disable starting of sessions before all settings are done
// does not work, besides how it is written in php manual
//ini_set('session.auto_start', 0);
// session cookie settings
session_set_cookie_params(0, PMA_Config::getCookiePath() . '; HttpOnly', '', PMA_Config::isHttps());
// cookies are safer
ini_set('session.use_cookies', true);
// but not all user allow cookies
ini_set('session.use_only_cookies', false);
ini_set('session.use_trans_sid', true);
ini_set('url_rewriter.tags', 'a=href,frame=src,input=src,form=fakeentry,fieldset=');
//ini_set('arg_separator.output', '&');
// delete session/cookies when browser is closed
ini_set('session.cookie_lifetime', 0);
// warn but dont work with bug
ini_set('session.bug_compat_42', false);
ini_set('session.bug_compat_warn', true);
// use more secure session ids (with PHP 5)
if (version_compare(PHP_VERSION, '5.0.0', 'ge') && substr(PHP_OS, 0, 3) != 'WIN') {
    ini_set('session.hash_function', 1);
开发者ID:rforillo,项目名称:wordpress-heroku2,代码行数:31,代码来源:session.inc.php

示例2: PMA_setCookie

/**
 * sets cookie if value is different from current cokkie value,
 * or removes if value is equal to default
 *
 * @uses    PMA_Config::isHttps()
 * @uses    PMA_Config::getCookiePath()
 * @uses    $_COOKIE
 * @uses    PMA_removeCookie()
 * @uses    setcookie()
 * @uses    time()
 * @param   string  $cookie     name of cookie to remove
 * @param   mixed   $value      new cookie value
 * @param   string  $default    default value
 * @param   int     $validity   validity of cookie in seconds (default is one month)
 * @param   bool    $httponlt   whether cookie is only for HTTP (and not for scripts)
 * @return  boolean result of setcookie()
 */
function PMA_setCookie($cookie, $value, $default = null, $validity = null, $httponly = true)
{
    if ($validity == null) {
        $validity = 2592000;
    }
    if (strlen($value) && null !== $default && $value === $default && isset($_COOKIE[$cookie])) {
        // remove cookie, default value is used
        return PMA_removeCookie($cookie);
    }
    if (!strlen($value) && isset($_COOKIE[$cookie])) {
        // remove cookie, value is empty
        return PMA_removeCookie($cookie);
    }
    if (!isset($_COOKIE[$cookie]) || $_COOKIE[$cookie] !== $value) {
        // set cookie with new value
        /* Calculate cookie validity */
        if ($validity == 0) {
            $v = 0;
        } else {
            $v = time() + $validity;
        }
        return setcookie($cookie, $value, $v, PMA_Config::getCookiePath(), '', PMA_Config::isHttps(), $httponly);
    }
    // cookie has already $value as value
    return true;
}
开发者ID:alexhava,项目名称:elixirjuice,代码行数:43,代码来源:core.lib.php

示例3: testGetCookiePath

 /**
  * Test for getting cookie path
  *
  * @param string $absolute The absolute URL used for phpMyAdmin
  * @param string $expected Expected cookie path
  *
  * @dataProvider cookieUris
  */
 public function testGetCookiePath($absolute, $expected)
 {
     $this->object->set('PmaAbsoluteUri', $absolute);
     $this->assertEquals($expected, $this->object->getCookiePath());
 }
开发者ID:rizwanaabbas,项目名称:phpmyadmin,代码行数:13,代码来源:PMA_Config_test.php

示例4: checkCookiePath

 /**
  * detect correct cookie path
  */
 function checkCookiePath()
 {
     $this->set('cookie_path', PMA_Config::getCookiePath());
 }
开发者ID:alecbenson,项目名称:TurnoutWeb-Patches,代码行数:7,代码来源:Config.class.php

示例5: PMA_setCookie

 /**
  * sets cookie if value is different from current cokkie value,
  * or removes if value is equal to default
  *
  * @uses    PMA_Config::isHttps()
  * @uses    PMA_Config::getCookiePath()
  * @uses    $_COOKIE
  * @uses    PMA_removeCookie()
  * @uses    setcookie()
  * @uses    time()
  * @param   string  $cookie     name of cookie to remove
  * @param   mixed   $value      new cookie value
  * @param   string  $default    default value
  * @return  boolean result of setcookie()
  */
 function PMA_setCookie($cookie, $value, $default = null)
 {
     if (strlen($value) && null !== $default && $value === $default && isset($_COOKIE[$cookie])) {
         // remove cookie, default value is used
         return PMA_removeCookie($cookie);
     }
     if (!strlen($value) && isset($_COOKIE[$cookie])) {
         // remove cookie, value is empty
         return PMA_removeCookie($cookie);
     }
     if (!isset($_COOKIE[$cookie]) || $_COOKIE[$cookie] !== $value) {
         // set cookie with new value
         return setcookie($cookie, $value, time() + 60 * 60 * 24 * 30, PMA_Config::getCookiePath(), '', PMA_Config::isHttps());
     }
     // cookie has already $value as value
     return true;
 }
开发者ID:a195474368,项目名称:ejiawang,代码行数:32,代码来源:common.lib.php

示例6: PMA_setCookie

/**
 * sets cookie if value is different from current cokkie value,
 * or removes if value is equal to default
 *
 * @uses    PMA_Config::isHttps()
 * @uses    PMA_Config::getCookiePath()
 * @uses    $_COOKIE
 * @uses    PMA_removeCookie()
 * @uses    setcookie()
 * @uses    time()
 * @param   string  $cookie     name of cookie to remove
 * @param   mixed   $value      new cookie value
 * @param   string  $default    default value
 * @param   int     $validity   validity of cookie in seconds (default is one month)
 * @param   bool    $httponlt   whether cookie is only for HTTP (and not for scripts)
 * @return  boolean result of setcookie()
 */
function PMA_setCookie($cookie, $value, $default = null, $validity = null, $httponly = true)
{
    if ($validity == null) {
        $validity = 2592000;
    }
    if (strlen($value) && null !== $default && $value === $default && isset($_COOKIE[$cookie])) {
        // remove cookie, default value is used
        return PMA_removeCookie($cookie);
    }
    if (!strlen($value) && isset($_COOKIE[$cookie])) {
        // remove cookie, value is empty
        return PMA_removeCookie($cookie);
    }
    if (!isset($_COOKIE[$cookie]) || $_COOKIE[$cookie] !== $value) {
        // set cookie with new value
        /* Calculate cookie validity */
        if ($validity == 0) {
            $v = 0;
        } else {
            $v = time() + $validity;
        }
        /* Use native support for httponly cookies if available */
        if (version_compare(PHP_VERSION, '5.2.0', 'ge')) {
            return setcookie($cookie, $value, $v, PMA_Config::getCookiePath(), '', PMA_Config::isHttps(), $httponly);
        } else {
            return setcookie($cookie, $value, $v, PMA_Config::getCookiePath() . ($httponly ? '; HttpOnly' : ''), '', PMA_Config::isHttps());
        }
    }
    // cookie has already $value as value
    return true;
}
开发者ID:rforillo,项目名称:wordpress-heroku2,代码行数:48,代码来源:common.lib.php


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