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


PHP session_module_name函数代码示例

本文整理汇总了PHP中session_module_name函数的典型用法代码示例。如果您正苦于以下问题:PHP session_module_name函数的具体用法?PHP session_module_name怎么用?PHP session_module_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 function __construct()
 {
     ini_set("session.save_handler", "user");
     session_module_name("user");
     session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
     session_start();
 }
开发者ID:huangbinzd,项目名称:kppwGit,代码行数:7,代码来源:keke_session_class.php

示例2: init

 public static function init()
 {
     $session_conf = Bd_Conf::getAppConf('session');
     $type = strtolower($session_conf['type']);
     $session_name = $session_conf['session_name'];
     $session_lifetime = $session_conf['lifetime'];
     $session_handler = null;
     if ($session_name) {
         session_name($session_name);
     }
     switch ($type) {
         case 'mysql':
             $db_conf_name = $session_conf['db_conf'];
             $db_conf = self::loadConfName($db_conf_name);
             //$db_proxy = Bd_Db_ConnMgr::getConn($db_conf,"session",false,true);
             //$db_proxy = new Navilib_DBFactory($db_conf);
             $db_conf = Bd_Conf::getConf('/db/' . $db_conf);
             //$session_handler = new Session_Mysql($db_proxy,$session_lifetime);
             $session_handler = new Session_Mysql($db_conf, $session_lifetime);
             break;
         default:
             // 默认存在本地文件
             break;
     }
     if ($session_handler) {
         session_module_name('user');
         //session_save_path('/tmp');
         session_set_save_handler(array(&$session_handler, 'open'), array(&$session_handler, 'close'), array(&$session_handler, 'read'), array(&$session_handler, 'write'), array(&$session_handler, 'destroy'), array(&$session_handler, 'gc'));
     }
 }
开发者ID:WayWingsDev,项目名称:mis,代码行数:30,代码来源:Factory.php

示例3: _init

 /**
  * Set up the session cache, hijacking handlers from ADODB_Session
  * presumably already in place.
  */
 function _init()
 {
     session_module_name('user');
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
     $this->enabled = TikiLib::lib("memcache")->isEnabled();
     $this->lib = TikiLib::lib("memcache");
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:11,代码来源:tikisession-memcache.php

示例4: RegisterGlobalState

function RegisterGlobalState()
{
    /* Deal with user specified session handlers */
    if (session_module_name() == "user") {
        $phperrorcsession = gettext("PHP ERROR: A custom (user) PHP session have been detected. However, BASE has not been set to explicitly use this custom handler.  Set <CODE>use_user_session=1</CODE> in <CODE>base_conf.php</CODE>");
        $phperrorcsessioncode = gettext("PHP ERROR: A custom (user) PHP session hander has been configured, but the supplied hander code specified in <CODE>user_session_path</CODE> is invalid.");
        $phperrorcsessionvar = gettext("PHP ERROR: A custom (user) PHP session handler has been configured, but the implementation of this handler has not been specified in BASE.  If a custom session handler is desired, set the <CODE>user_session_path</CODE> variable in <CODE>base_conf.php</CODE>.");
        if ($GLOBALS['use_user_session'] != 1) {
            ErrorMessage($phperrorcsession);
            die;
        } else {
            if ($GLOBALS['user_session_path'] != "") {
                if (is_file($GLOBALS['user_session_path'])) {
                    ErrorMessage(_("Custom User PHP session handlers are deprecated in this version of SIEM Events Console"));
                    die;
                    //include_once ($GLOBALS['user_session_path']);
                    //if ($GLOBALS['user_session_function'] != "") $GLOBALS['user_session_function']();
                } else {
                    ErrorMessage($phperrorcsessioncode);
                    die;
                }
            } else {
                ErrorMessage($phperrorcsessionvar);
                die;
            }
        }
    }
    //session_start();
    //if ($GLOBALS['debug_mode'] > 0) echo '<FONT COLOR="#FF0000">' . gettext("Session Registered") . '</FONT><BR>';
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:30,代码来源:base_state_common.inc.php

示例5: CInstaller

 function CInstaller()
 {
     $sName = 'WM_INSTALLER';
     if (@session_name() !== $sName) {
         if (@session_name()) {
             @session_write_close();
             if (isset($GLOBALS['PROD_NAME']) && false !== strpos($GLOBALS['PROD_NAME'], 'Plesk')) {
                 @session_module_name('files');
             }
         }
         @session_set_cookie_params(0);
         @session_name($sName);
         @session_start();
     }
     $this->_sState = isset($_GET['step']) ? $_GET['step'] : 'index';
     $this->_aTemplateCache = array();
     $this->_aMenu = array('compatibility', 'license', 'license-key', 'db', 'dav', 'admin-panel', 'email-server-test', 'completed');
     if (@file_exists(WM_INSTALLER_PATH . '../libraries/afterlogic/common/lite.php')) {
         // Lite version steps
         unset($this->_aMenu[2]);
         // 'license-key'
         unset($this->_aMenu[4]);
         // 'dav'
         unset($this->_aSteps['license-key']);
         unset($this->_aSteps['dav']);
     }
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:27,代码来源:installer.php

示例6: __construct

 public function __construct($type = 'cache')
 {
     $this->lifeTime = $GLOBALS['_session_lifetime'];
     //不使用 GET/POST 变量方式
     ini_set('session.use_trans_sid', 0);
     // 是否自动启动
     ini_set('session.auto_start', 0);
     //设置垃圾回收最大生存时间
     ini_set('session.gc_maxlifetime', $this->lifeTime);
     //使用 COOKIE 保存 SESSION ID 的方式
     ini_set('session.use_cookies', 1);
     session_set_cookie_params($GLOBALS['_cookie_expire'], $GLOBALS['_cookie_path'], $GLOBALS['_cookie_domain']);
     //将 session.save_handler 设置为 user,而不是默认的 files
     session_module_name('user');
     switch ($type) {
         case 'memcache':
             ini_set('session.save_handler', $type);
             ini_set('session.save_path', $GLOBALS['_session_path']);
             break;
         case 'cache':
             session_set_save_handler(array($this, "cache_open"), array($this, "cache_close"), array($this, "cache_read"), array($this, "cache_write"), array($this, "cache_destroy"), array($this, "cache_gc"));
             break;
             // 默认使用db
         // 默认使用db
         default:
             session_set_save_handler(array($this, "db_open"), array($this, "db_close"), array($this, "db_read"), array($this, "db_write"), array($this, "db_destroy"), array($this, "db_gc"));
             break;
     }
     session_start();
 }
开发者ID:noikiy,项目名称:dophin,代码行数:30,代码来源:Session.class.php

示例7: sessionModuleName

 public function sessionModuleName($module = null)
 {
     if (null === $module) {
         return session_module_name();
     }
     return session_module_name($module);
 }
开发者ID:usebeagle,项目名称:session,代码行数:7,代码来源:NativeFunctionStrategy.php

示例8: __construct

 /**
  * Create a new PHPSession object using the provided options (if any)
  *
  * @param   array   $options    An optional array of ini options to set
  *
  * @throws  ConfigurationError
  * @see     http://php.net/manual/en/session.configuration.php
  */
 public function __construct(array $options = null)
 {
     if ($options !== null) {
         $options = array_merge(self::$defaultCookieOptions, $options);
     } else {
         $options = self::$defaultCookieOptions;
     }
     if (array_key_exists('test_session_name', $options)) {
         $this->sessionName = $options['test_session_name'];
         unset($options['test_session_name']);
     }
     foreach ($options as $sessionVar => $value) {
         if (ini_set("session." . $sessionVar, $value) === false) {
             Logger::warning('Could not set php.ini setting %s = %s. This might affect your sessions behaviour.', $sessionVar, $value);
         }
     }
     $sessionSavePath = session_save_path() ?: sys_get_temp_dir();
     if (session_module_name() === 'files' && !is_writable($sessionSavePath)) {
         throw new ConfigurationError("Can't save session, path '{$sessionSavePath}' is not writable.");
     }
     if ($this->exists()) {
         // We do not want to start a new session here if there is not any
         $this->read();
     }
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:33,代码来源:PhpSession.php

示例9: RegisterGlobalState

function RegisterGlobalState()
{
    /* Deal with user specified session handlers */
    if (session_module_name() == "user") {
        if ($GLOBALS['use_user_session'] != 1) {
            ErrorMessage("PHP ERROR: A custom (user) PHP session have been detected. However, ACID has not been " . "set to explicitly use this custom handler.  Set <CODE>use_user_session=1</CODE> in " . "<CODE>acid_conf.php</CODE>");
            die;
        } else {
            if ($GLOBALS['user_session_path'] != "") {
                if (is_file($GLOBALS['user_session_path'])) {
                    include_once $GLOBALS['user_session_path'];
                    if ($GLOBALS['user_session_function'] != "") {
                        $GLOBALS['user_session_function']();
                    }
                } else {
                    ErrorMessage("PHP ERROR: A custom (user) PHP session hander has been configured, but the supplied " . "hander code specified in <CODE>user_session_path</CODE> is invalid.");
                    die;
                }
            } else {
                ErrorMessage("PHP ERROR: A custom (user) PHP session handler has been configured, but the implementation " . "of this handler has not been specified in ACID.  If a custom session handler is desired, " . "set the <CODE>user_session_path</CODE> variable in <CODE>acid_conf.php</CODE>.");
                die;
            }
        }
    }
    session_start();
    if ($GLOBALS['debug_mode'] > 0) {
        echo '<FONT COLOR="#FF0000">Session Registered</FONT><BR>';
    }
}
开发者ID:sunzhuo1987,项目名称:aegis--shield,代码行数:29,代码来源:state_common.php

示例10: _setSessionModule

 /**
  * Set Session Module
  */
 private function _setSessionModule()
 {
     session_module_name('user');
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
     register_shutdown_function('session_write_close');
     session_start();
 }
开发者ID:bearlord,项目名称:kantphp2,代码行数:10,代码来源:SessionSqlite.php

示例11: __construct

 private function __construct($config = array())
 {
     $this->config = array_merge($this->config, $config);
     if ($this->config['cookie_domain'] == null) {
         $this->config['cookie_domain'] = $_SERVER['HTTP_HOST'];
     }
     if ($this->config['cookie_secure'] === null) {
         $this->config['cookie_secure'] = config::$https;
     }
     if ($this->config['memcache']) {
         if (is_array($this->config['memcache']) && !empty($this->config['memcache']['host']) && !empty($this->config['memcache']['port'])) {
             $host = $this->config['memcache']['host'];
             $port = $this->config['memcache']['port'];
         } else {
             $host = 'localhost';
             $port = 11211;
         }
         session_module_name('memcache');
         session_save_path("tcp://{$host}:{$port}?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15");
     }
     if (isset($_COOKIE[$this->config['cookie_name']]) && preg_match('/^[a-zA-Z0-9]{' . $this->config['cookie_session_id_key_len'] . '}$/', $_COOKIE[$this->config['cookie_name']])) {
         $this->session_id = $_COOKIE[$this->config['cookie_name']];
     } else {
         $this->session_id = utils::get_random_code($this->config['cookie_session_id_key_len']);
         session_id($this->session_id);
     }
     session_name($this->config['cookie_name']);
     session_set_cookie_params(0, $this->config['cookie_path'], $this->config['cookie_domain'], $this->config['cookie_secure'], $this->config['cookie_http_only']);
     session_start();
 }
开发者ID:ximik777,项目名称:core,代码行数:30,代码来源:session.class.php

示例12: start

 public function start($sessionName = null)
 {
     if (isset($_SESSION)) {
         return $this;
     }
     Varien_Profiler::start(__METHOD__ . '/setOptions');
     if (is_writable(Mage::getBaseDir('session'))) {
         session_save_path(Mage::getBaseDir('session'));
     }
     Varien_Profiler::stop(__METHOD__ . '/setOptions');
     session_module_name('files');
     /*
             $sessionResource = Mage::getResourceSingleton('core/session');
             $sessionResource->setSaveHandler();
     */
     if ($this->getCookieLifetime() !== null) {
         ini_set('session.gc_maxlifetime', $this->getCookieLifetime());
     }
     if ($this->getCookiePath() !== null) {
         ini_set('session.cookie_path', $this->getCookiePath());
     }
     if ($this->getCookieDomain() !== null) {
         ini_set('session.cookie_domain', $this->getCookieDomain());
     }
     if (!empty($sessionName)) {
         session_name($sessionName);
     }
     // potential custom logic for session id (ex. switching between hosts)
     $this->setSessionId();
     Varien_Profiler::start(__METHOD__ . '/start');
     session_start();
     Varien_Profiler::stop(__METHOD__ . '/start');
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:34,代码来源:Varien.php

示例13: start

 /**
  * Conigure and start session
  *
  * @param string $sessionName
  * @return Mage_Core_Model_Session_Abstract_Varien
  */
 public function start($sessionName = null)
 {
     if (isset($_SESSION)) {
         return $this;
     }
     switch ($this->getSessionSaveMethod()) {
         case 'db':
             ini_set('session.save_handler', 'user');
             $sessionResource = Mage::getResourceSingleton('core/session');
             /* @var $sessionResource Mage_Core_Model_Mysql4_Session */
             $sessionResource->setSaveHandler();
             break;
         case 'memcache':
             ini_set('session.save_handler', 'memcache');
             session_save_path($this->getSessionSavePath());
             break;
         case 'eaccelerator':
             ini_set('session.save_handler', 'eaccelerator');
             break;
         default:
             session_module_name('files');
             if (is_writable(Mage::getBaseDir('session'))) {
                 session_save_path($this->getSessionSavePath());
             }
             break;
     }
     if (Mage::app()->getStore()->isAdmin()) {
         $adminSessionLifetime = (int) Mage::getStoreConfig('admin/security/session_cookie_lifetime');
         if ($adminSessionLifetime > 60) {
             $this->getCookie()->setLifetime($adminSessionLifetime);
         }
     }
     // session cookie params
     $cookieParams = array('lifetime' => $this->getCookie()->getLifetime(), 'path' => $this->getCookie()->getPath(), 'domain' => $this->getCookie()->getConfigDomain(), 'secure' => $this->getCookie()->isSecure(), 'httponly' => $this->getCookie()->getHttponly());
     if (!$cookieParams['httponly']) {
         unset($cookieParams['httponly']);
         if (!$cookieParams['secure']) {
             unset($cookieParams['secure']);
             if (!$cookieParams['domain']) {
                 unset($cookieParams['domain']);
             }
         }
     }
     if (isset($cookieParams['domain'])) {
         $cookieParams['domain'] = $this->getCookie()->getDomain();
     }
     call_user_func_array('session_set_cookie_params', $cookieParams);
     if (!empty($sessionName)) {
         $this->setSessionName($sessionName);
     }
     // potential custom logic for session id (ex. switching between hosts)
     $this->setSessionId();
     Varien_Profiler::start(__METHOD__ . '/start');
     if ($sessionCacheLimiter = Mage::getConfig()->getNode('global/session_cache_limiter')) {
         session_cache_limiter((string) $sessionCacheLimiter);
     }
     session_start();
     Varien_Profiler::stop(__METHOD__ . '/start');
     return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:66,代码来源:Varien.php

示例14: begin

 /**
  * 开始使用该驱动的session
  */
 public function begin()
 {
     ini_set('session.gc_maxlifetime', $this->_options['LIFETIME']);
     ini_set('session.cookie_domain', $this->_options['DOMAIN']);
     ini_set('session.use_cookies', 1);
     ini_set('session.cookie_path', '/');
     ini_set('session.hash_bits_per_character', 4);
     session_module_name('user');
     //设置session处理函数
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
     /**
      * When using objects as session save handlers, it is important to register the shutdown function with PHP to avoid unexpected
      * side-effects from the way PHP internally destroys objects on shutdown and may prevent the write and close from being called.
      * Typically you should register 'session_write_close' useing the register_shutdown_function() function.
      * As of PHP 5.4.0 you can use session_register_shutdown() or simply use the 'register shutdown' flag when invoking
      * session_set_save_handler() useing the OOP method and passing an instance that implements SessionHandlerInterface.
      *
      * As of PHP 5.0.5 the write and close handlers are called after object destruction and therefore cannot use objects or throw
      * exceptions. Exceptions are not able to be caught since will not be caught nor will any exception trace be displayed and the
      * execution will just cease unexpectedly. The object destructors can however use sessions.
      * It is possible to call session_write_close() from the destructor to solve this chicken and egg problem but the most reliable
      * way is to register the shutdown function as described above.
      */
     register_shutdown_function('session_write_close');
 }
开发者ID:iliubang,项目名称:Linger-v2.0,代码行数:28,代码来源:Redis.php

示例15: __construct

 public function __construct($isStart = true)
 {
     if ($isStart) {
         session_module_name('user');
         session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destory'), array($this, 'gc'));
         session_start();
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:8,代码来源:Sessiond.php


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