本文整理汇总了PHP中Zend_Session::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session::setId方法的具体用法?PHP Zend_Session::setId怎么用?PHP Zend_Session::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Session
的用法示例。
在下文中一共展示了Zend_Session::setId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateAction
public function generateAction()
{
$this->_helper->layout->disableLayout();
$req = $this->getRequest();
$returnTo = $req->getParam('returnTo') ? $req->getParam('returnTo') : ROOT_URL;
setcookie('returnMeTo', base64_decode($returnTo), null, '/');
$flagSessionIdSent = false;
if (isset($_GET['PHPSESSID']) && !empty($_GET['PHPSESSID'])) {
$sessid = $_GET['PHPSESSID'];
Zend_Session::setId($sessid);
$flagSessionIdSent = true;
}
if ($flagSessionIdSent) {
$saveHandlerManager = new Pandamp_Session_SaveHandler_Manager();
$saveHandlerManager->setSaveHandler();
Zend_Session::start();
if (isset($_COOKIE['returnMeTo']) && !empty($_COOKIE['returnMeTo'])) {
header("location: " . $_COOKIE['returnMeTo']);
exit;
}
} else {
$identity = Pandamp_Application::getResource('identity');
$url = $identity->loginUrl;
$sReturn = ROOT_URL . '/helper/synclogin/generate';
$sReturn = base64_encode($sReturn);
header("location: {$url}/?returnTo=" . $sReturn);
exit;
}
}
示例2: __construct
public function __construct($namespace = self::NAMESPACE_DEFAULT, $member = self::MEMBER_DEFAULT)
{
session_name($this->_generateSessionName());
if (!self::$_id) {
self::$_id = Glo_Util_Uuid::generate();
}
Zend_Session::setId(self::$_id);
parent::__construct($namespace, $member);
}
示例3: setsessionAction
public function setsessionAction()
{
header('Content-Type: text/javascript; charset=' . 'iso-8859-1');
$r - $this->getRequest();
$sessid = $r->getParam('PHPSESSID');
Zend_Session::setId($sessid);
Zend_Session::start();
die;
}
示例4: __construct
/**
* Sets session storage options and initializes session namespace object
*
* @param mixed $namespace
* @param mixed $member
* @param string $sessionId
* @return void
*/
public function __construct($namespace = self::NAMESPACE_DEFAULT, $member = self::MEMBER_DEFAULT, $sessionId = null)
{
$this->_namespace = $namespace;
$this->_member = $member;
if (null !== $sessionId && !Zend_Session::sessionExists()) {
Zend_Session::setId($sessionId);
}
$this->_session = new Zend_Session_Namespace($this->_namespace);
}
示例5: __construct
/**
*
*/
public function __construct($application)
{
//restore the session id after flash upload
$request = $this->getRequest();
if ($request->isFlashRequest()) {
$sessionId = $this->getRequest()->getParam('PHPSESSID');
if (!is_null($sessionId)) {
Zend_Session::setId($sessionId);
}
}
parent::__construct($application);
}
示例6: getApplications
/**
* @param string $sSessionId
* @param string $sPlatform
* @return array
*/
public function getApplications($sSessionId, $sPlatform = self::PLATFORM_IOS)
{
Zend_Session::setId((string) $sSessionId);
$oAuth = Zend_Auth::getInstance();
if (!$oAuth->hasIdentity()) {
$aResult = array('code' => self::RESULT_WRONG_SESSION_ID, 'messages' => array('Failure due to incorrect session id'));
return $aResult;
}
$sPlatform = trim($sPlatform);
if (!in_array($sPlatform, $this->_aValidPlatforms)) {
$sPlatform = self::PLATFORM_IOS;
}
$aResult = array('code' => self::RESULT_SUCCESS, 'applications' => array());
$oUser = $oAuth->getIdentity();
$aCriteria = array('deleted' => 'no');
if (!$oUser->is_admin) {
$aCriteria['client'] = $oUser->client;
}
$oApplications = AM_Model_Db_Table_Abstract::factory('application')->findAllBy($aCriteria);
foreach ($oApplications as $oApplication) {
$aApplication = array('application_id' => $oApplication->id, 'application_title' => $oApplication->title, 'application_description' => $oApplication->description, 'application_product_id' => $oApplication->product_id, 'application_notification_email' => $oApplication->{'nm_email_' . $sPlatform}, 'application_notification_email_title' => $oApplication->{'nt_email_' . $sPlatform}, 'application_notification_twitter' => $oApplication->{'nm_twitter_' . $sPlatform}, 'application_notification_facebook' => $oApplication->{'nm_fbook_' . $sPlatform}, 'application_preview' => $oApplication->preview, 'issues' => array());
$oIssues = AM_Model_Db_Table_Abstract::factory('issue')->findAllBy(array('application' => $oApplication->id, 'deleted' => 'no'));
foreach ($oIssues as $oIssue) {
$aIssue = array('issue_id' => $oIssue->id, 'issue_title' => $oIssue->title, 'issue_number' => $oIssue->number, 'issue_state' => AM_Model_Db_State::stateToName($oIssue->state), 'issue_product_id' => $oIssue->product_id, 'revisions' => array());
//Prepearing help pages
$oHelpPages = AM_Model_Db_Table_Abstract::factory('issue_help_page')->findAllBy(array('id_issue' => $oIssue->id));
$oRevisions = AM_Model_Db_Table_Abstract::factory('revision')->findAllBy(array('issue' => $oIssue->id, 'deleted' => 'no'));
foreach ($oRevisions as $oRevision) {
$aRevision = array('revision_id' => $oRevision->id, 'revision_title' => $oRevision->title, 'revision_state' => AM_Model_Db_State::stateToName($oRevision->state), 'revision_cover_image_list' => '', 'revision_video' => '', 'revision_created' => null, 'revision_color' => $oIssue->issue_color, 'summary_color' => $oIssue->summary_color, 'pastille_color' => $oIssue->pastille_color, 'revision_horizontal_mode' => $oIssue->static_pdf_mode, 'revision_orientation' => $oIssue->orientation, 'help_pages' => array(AM_Model_Db_IssueHelpPage::TYPE_HORIZONTAL => '', AM_Model_Db_IssueHelpPage::TYPE_VERTICAL => ''));
foreach ($oHelpPages as $oHelpPage) {
/* @var $oHelpPage AM_Model_Db_IssueHelpPage */
$aRevision['help_pages'][$oHelpPage->type] = (string) $oHelpPage->getResource()->getResourcePathForExport();
}
//Revision creation date
$oDate = new Zend_Date($oRevision->created);
$aRevision['revision_created'] = $oDate->toString(Zend_Date::ISO_8601);
$oPageCover = AM_Model_Db_Table_Abstract::factory('revision')->findOneBy('id', $oRevision->id)->getPageRoot();
/* @var $oPageCover AM_Model_Db_Page */
if (!is_null($oPageCover)) {
$aRevision['revision_cover_image_list'] = (string) $oPageCover->getPageCoverUri();
$aRevision['revision_video'] = (string) $oPageCover->getStartVideoUri();
}
$aIssue['revisions'][$oRevision->id] = $aRevision;
}
$aApplication['issues'][$oIssue->id] = $aIssue;
}
$aResult['applications'][$oApplication->id] = $aApplication;
}
return $aResult;
}
示例7: start
function start()
{
$registry = Zend_Registry::getInstance();
$config = $registry->get('config');
$url = $config->session->config->remote->sessionidgenerator->url;
require_once 'Zend/Session.php';
$saveHandler = $config->session->savehandler;
$flagDoSyncSession = $this->_flagDoSyncSession;
switch (strtolower($saveHandler)) {
case 'remote':
require_once 'Kutu/Session/SaveHandler/Remote.php';
$sessionHandler = new Kutu_Session_SaveHandler_Remote();
Zend_Session::setSaveHandler($sessionHandler);
break;
default:
$flagDoSyncSession = false;
break;
}
if ($this->_flagDoSyncSession) {
$flagSessionIdSent = false;
if (isset($_POST['PHPSESSID']) && !empty($_POST['PHPSESSID'])) {
$sessid = $_POST['PHPSESSID'];
Zend_Session::setId($sessid);
$flagSessionIdSent = true;
}
if (isset($_GET['PHPSESSID']) && !empty($_GET['PHPSESSID'])) {
$sessid = $_GET['PHPSESSID'];
Zend_Session::setId($sessid);
$flagSessionIdSent = true;
}
if (isset($_COOKIE['PHPSESSID']) && !empty($_COOKIE['PHPSESSID'])) {
$flagSessionIdSent = true;
}
if (!$flagSessionIdSent) {
//redirect to session local sync startpoint
$sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$sReturn = base64_encode($sReturn);
$url = $config->session->config->local->sync->url;
$url = KUTU_ROOT_URL . $url;
header("location: {$url}?returnTo=" . $sReturn);
exit;
} else {
Zend_Session::start();
}
} else {
Zend_Session::start();
}
}
示例8: loginAction
public function loginAction()
{
$this->_helper->layout->disableLayout();
$req = $this->getRequest();
$returnTo = $req->getParam('returnTo') ? $req->getParam('returnTo') : KUTU_ROOT_URL;
setcookie('returnMeTo', urldecode($returnTo), null, '/');
$flagSessionIdSent = false;
if (isset($_GET['PHPSESSID']) && !empty($_GET['PHPSESSID'])) {
if (Zend_Session::sessionExists()) {
if (!($_COOKIE['PHPSESSID'] == $_GET['PHPSESSID'])) {
//Zend_Session::destroy(true);
$sessid = $_GET['PHPSESSID'];
Zend_Session::setId($sessid);
$saveHandlerManager = new Kutu_Session_SaveHandler_Manager();
$saveHandlerManager->setSaveHandler();
Zend_Session::start();
}
} else {
$saveHandlerManager = new Kutu_Session_SaveHandler_Manager();
$saveHandlerManager->setSaveHandler();
Zend_Session::start();
}
$flagSessionIdSent = true;
}
if ($flagSessionIdSent) {
if (isset($_COOKIE['returnMeTo']) && !empty($_COOKIE['returnMeTo'])) {
header("location: " . $_COOKIE['returnMeTo']);
exit;
}
} else {
$registry = Zend_Registry::getInstance();
$config = $registry->get('config');
$url = $config->identity->login->url;
$sReturn = KUTU_ROOT_URL . '/helper/sso/login';
$sReturn = urlencode($sReturn);
header("location: {$url}/?returnTo=" . $sReturn);
exit;
}
}
示例9: _initSession
public function _initSession()
{
$config = new Zend_Config_Ini(realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'session.ini', 'development');
// Flash has problems with cookies so we pass the PHPSESSID variable via get
if (substr_count($_SERVER['REQUEST_URI'], 'sessionid/') != 0) {
$start = stripos($_SERVER['REQUEST_URI'], 'sessionid/') + 10;
$end = strpos($_SERVER['REQUEST_URI'], '/', $start);
if ($end > $start) {
$sid = substr($_SERVER['REQUEST_URI'], $start, $end);
} else {
$sid = substr($_SERVER['REQUEST_URI'], $start);
}
$prefix = '';
if (!empty($_SERVER["HTTP_COOKIE"])) {
$prefix = '; ';
}
$_SERVER["HTTP_COOKIE"] = $prefix . $config->name . '=' . $sid;
$_COOKIE[$config->name] = $sid;
Zend_Session::setId($sid);
}
Zend_Session::setOptions($config->toArray());
}
示例10: initSession
/**
* @static
* @return void
*/
public static function initSession()
{
if (!\Zend_Session::isStarted()) {
\Zend_Session::setOptions(self::$options);
}
try {
try {
if (!\Zend_Session::isStarted()) {
$sName = self::getOption("name");
// only set the session id if the cookie isn't present, otherwise Set-Cookie is always in the headers
if (array_key_exists($sName, $_REQUEST) && !empty($_REQUEST[$sName]) && (!array_key_exists($sName, $_COOKIE) || empty($_COOKIE[$sName]))) {
// get zend_session work with session-id via get (since SwfUpload doesn't support cookies)
\Zend_Session::setId($_REQUEST[$sName]);
}
}
} catch (\Exception $e) {
\Logger::error("Problem while starting session");
\Logger::error($e);
}
} catch (\Exception $e) {
\Logger::emergency("there is a problem with admin session");
die;
}
}
示例11: get
/**
* @param string $namespace
* @param bool $readOnly
* @return \Zend_Session_Namespace
* @throws \Zend_Session_Exception
*/
public static function get($namespace = "pimcore_admin", $readOnly = false)
{
$initSession = !\Zend_Session::isStarted();
$forceStart = !$readOnly;
// we don't force the session to start in read-only mode (default behavior)
$sName = self::getOption("name");
if (self::backupForeignSession()) {
$initSession = true;
$forceStart = true;
}
if ($initSession) {
\Zend_Session::setOptions(self::$options);
}
try {
try {
if ($initSession) {
// only set the session id if the cookie isn't present, otherwise Set-Cookie is always in the headers
if (array_key_exists($sName, $_REQUEST) && !empty($_REQUEST[$sName]) && (!array_key_exists($sName, $_COOKIE) || empty($_COOKIE[$sName]))) {
// get zend_session work with session-id via get (since SwfUpload doesn't support cookies)
\Zend_Session::setId($_REQUEST[$sName]);
}
}
} catch (\Exception $e) {
\Logger::error("Problem while starting session");
\Logger::error($e);
}
} catch (\Exception $e) {
\Logger::emergency("there is a problem with admin session");
die;
}
if ($initSession) {
\Zend_Session::start();
}
if ($forceStart) {
@session_start();
self::$sessionCookieCleanupNeeded = true;
}
if (!array_key_exists($namespace, self::$sessions) || !self::$sessions[$namespace] instanceof \Zend_Session_Namespace) {
try {
self::$sessions[$namespace] = new Session\Container($namespace);
} catch (\Exception $e) {
// invalid session, regenerate the session, and return a dummy object
\Zend_Session::regenerateId();
return new \stdClass();
}
}
self::$openedSessions++;
self::$sessions[$namespace]->unlock();
return self::$sessions[$namespace];
}
示例12: testRegenerateId
/**
* test session id manipulations; expect isRegenerated flag == true
*
* @return void
*/
public function testRegenerateId()
{
Zend_Session::setId('myid123');
Zend_Session::regenerateId();
$this->assertFalse(Zend_Session::isRegenerated());
$id = Zend_Session::getId();
$this->assertTrue($id === 'myid123', 'getId() reported something different than set via setId("myid123")');
Zend_Session::start();
$this->assertTrue(Zend_Session::isRegenerated());
try {
Zend_Session::setId($id);
$this->fail('No exception was returned when trying to set the session id, after session_start()');
} catch (Zend_Session_Exception $e) {
$this->assertRegexp('/already.*started/i', $e->getMessage());
}
}
示例13: setId
/**
* セッションIDを設定
*
* @static
* @access public
* @param int $id ID
*/
public static function setId($id)
{
parent::setId($id);
}
示例14: _initSession
protected function _initSession()
{
$name = 'en4_install';
Zend_Session::setOptions(array('name' => $name, 'cookie_path' => substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') + 1), 'cookie_lifetime' => 0, 'gc_maxlifetime' => 86400, 'remember_me_seconds' => 86400, 'cookie_httponly' => false));
session_name($name);
// Check for bad session config
if (function_exists('ini_get') && in_array(strtolower(ini_get('session.save_handler')), array('user', 'users', 'files'))) {
$flag = true;
if ('files' !== ini_get('session.save_handler') && function_exists('ini_set')) {
$flag = false !== ini_set('session.save_handler', 'files');
}
if (function_exists('ini_set') && $flag && false !== ini_set('session.save_path', APPLICATION_PATH . '/temporary/session/')) {
if (!is_writable(APPLICATION_PATH . '/temporary/session/')) {
throw new Exception('Please set full permissions on temporary/session (chmod 0777).');
}
} else {
throw new Exception('Your session configuration is incorrect and ' . 'could not be automatically corrected. Please set ' . 'session.save_handler=files and session.save_path=/tmp (or your ' . 'temporary directory on non-Linux OSes.');
}
}
// Session hack for fancy upload
if (isset($_POST[session_name()])) {
Zend_Session::setId($_POST[session_name()]);
} else {
if (isset($_COOKIE[session_name()])) {
Zend_Session::setId($_COOKIE[session_name()]);
}
}
// Start
try {
Zend_Session::start();
} catch (Exception $e) {
// This will generally happen when weird data is saved during the install process
if (Zend_Session::isStarted()) {
Zend_Session::destroy();
}
throw $e;
}
// Session binding
$fixed = true;
$namespace = new Zend_Session_Namespace('ZendSession');
if (empty($namespace->ip)) {
$namespace->ip = $_SERVER['REMOTE_ADDR'];
$namespace->ua = @$_SERVER['HTTP_USER_AGENT'];
} else {
if ($namespace->ip != $_SERVER['REMOTE_ADDR']) {
$fixed = false;
}
}
// Occaisonally regenerate the id if requesting with the original user agent
/*
if( empty($namespace->count) ) {
$namespace->count = 1;
} else if( $namespace->count < 10 ) {
$namespace->count++;
} else if( $namespace->ua == $_SERVER['HTTP_USER_AGENT'] ) {
Zend_Session::regenerateId();
}
*/
if (!$fixed) {
Zend_Session::destroy();
header('Location: ' . $_SERVER['REQUEST_URI']);
exit;
}
}
示例15: set_time_limit
set_time_limit($max_execution_time);
}
}
$rule = WT_DB::prepare("SELECT SQL_CACHE rule FROM `##site_access_rule`" . " WHERE IFNULL(INET_ATON(?), 0) BETWEEN ip_address_start AND ip_address_end" . " AND ? LIKE user_agent_pattern" . " ORDER BY ip_address_end LIMIT 1")->execute(array($WT_REQUEST->getClientIp(), $_SERVER['HTTP_USER_AGENT']))->fetchOne();
switch ($rule) {
case 'allow':
$SEARCH_SPIDER = false;
break;
case 'deny':
header('HTTP/1.1 403 Access Denied');
exit;
case 'robot':
case 'unknown':
// Search engines don’t send cookies, and so create a new session with every visit.
// Make sure they always use the same one
Zend_Session::setId('search-engine-' . str_replace('.', '-', $WT_REQUEST->getClientIp()));
$SEARCH_SPIDER = true;
break;
case '':
WT_DB::prepare("INSERT INTO `##site_access_rule` (ip_address_start, ip_address_end, user_agent_pattern, comment) VALUES (IFNULL(INET_ATON(?), 0), IFNULL(INET_ATON(?), 4294967295), ?, '')")->execute(array($WT_REQUEST->getClientIp(), $WT_REQUEST->getClientIp(), $_SERVER['HTTP_USER_AGENT']));
$SEARCH_SPIDER = true;
break;
}
// Store our session data in the database.
session_set_save_handler(function () {
return true;
}, function () {
return true;
}, function ($id) {
return WT_DB::prepare("SELECT session_data FROM `##session` WHERE session_id=?")->execute(array($id))->fetchOne();
}, function ($id, $data) use($WT_REQUEST) {