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


PHP CHttpSession::regenerateID方法代碼示例

本文整理匯總了PHP中CHttpSession::regenerateID方法的典型用法代碼示例。如果您正苦於以下問題:PHP CHttpSession::regenerateID方法的具體用法?PHP CHttpSession::regenerateID怎麽用?PHP CHttpSession::regenerateID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CHttpSession的用法示例。


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

示例1: regenerateID

 /**
  * Updates the current session id with a newly generated one.
  * Please refer to {@link http://php.net/session_regenerate_id} for more details.
  * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
  * @since 1.1.8
  */
 public function regenerateID($deleteOldSession = false)
 {
     $oldID = session_id();
     // if no session is started, there is nothing to regenerate
     if (empty($oldID)) {
         return;
     }
     parent::regenerateID(false);
     $newID = session_id();
     $db = $this->getDbConnection();
     $row = $db->{$this->sessionTableName}->findOne(array('id' => $oldID));
     if ($row) {
         // $row should either be a truey value or a falsey value
         if ($deleteOldSession) {
             $db->{$this->sessionTableName}->update(array('id' => $oldID), array('$set' => array('id' => $newID)));
         } else {
             unset($row['_id']);
             $row['id'] = $newID;
             $db->{$this->sessionTableName}->insert($row);
         }
     } else {
         // shouldn't reach here normally
         $db->{$this->sessionTableName}->insert(array('id' => $newID, 'expire' => time() + $this->getTimeout()));
     }
 }
開發者ID:pvassiliou,項目名稱:MongoYii,代碼行數:31,代碼來源:EMongoSession.php

示例2: regenerateID

 /**
  * Updates the current session id with a newly generated one.
  * Please refer to {@link http://php.net/session_regenerate_id} for more details.
  * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
  * @since 1.1.8
  */
 public function regenerateID($deleteOldSession = false)
 {
     $oldID = session_id();
     // if no session is started, there is nothing to regenerate
     if (empty($oldID)) {
         return;
     }
     parent::regenerateID(false);
     $newID = session_id();
     $db = $this->getDbConnection();
     $row = $db->createCommand()->select()->from($this->sessionTableName)->where('id=:id', array(':id' => $oldID))->queryRow();
     if ($row !== false) {
         if ($deleteOldSession) {
             $db->createCommand()->update($this->sessionTableName, array('id' => $newID), 'id=:oldID', array(':oldID' => $oldID));
         } else {
             $row['id'] = $newID;
             $db->createCommand()->insert($this->sessionTableName, $row);
         }
     } else {
         // shouldn't reach here normally
         $db->createCommand()->insert($this->sessionTableName, array('id' => $newID, 'expire' => time() + $this->getTimeout()));
     }
 }
開發者ID:pathman,項目名稱:yii-basic,代碼行數:29,代碼來源:CDbHttpSession.php

示例3: regenerateID

 /**
  * Updates the current session id with a newly generated one .
  * Please refer to {@link http://php.net/session_regenerate_id} for more details.
  * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
  * @since 1.1.8
  */
 public function regenerateID($deleteOldSession = false)
 {
     $oldID = session_id();
     parent::regenerateID(false);
     $newID = session_id();
     $db = $this->getDbConnection();
     $sql = "SELECT * FROM {$this->sessionTableName} WHERE id=:id";
     $row = $db->createCommand($sql)->bindValue(':id', $oldID)->queryRow();
     if ($row !== false) {
         if ($deleteOldSession) {
             $sql = "UPDATE {$this->sessionTableName} SET id=:newID WHERE id=:oldID";
             $db->createCommand($sql)->bindValue(':newID', $newID)->bindValue(':oldID', $oldID)->execute();
         } else {
             $row['id'] = $newID;
             $db->createCommand()->insert($this->sessionTableName, $row);
         }
     } else {
         // shouldn't reach here normally
         $db->createCommand()->insert($this->sessionTableName, array('id' => $newID, 'expire' => time() + $this->getTimeout()));
     }
 }
開發者ID:romeo14,項目名稱:wallfeet,代碼行數:27,代碼來源:CDbHttpSession.php

示例4: regenerateID

 /**
  * Updates the current session id with a newly generated one.
  * Please refer to {@link http://php.net/session_regenerate_id} for more details.
  * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
  * @since 1.1.8
  */
 public function regenerateID($deleteOldSession = false)
 {
     $oldId = session_id();
     parent::regenerateID(false);
     $newId = session_id();
     $row = $this->getData($oldId);
     if (is_null($row)) {
         $this->_collection->insert(array($this->idColumn => $newId, $this->expireColumn => $this->getExipireTime()), $this->_options);
     } else {
         if ($deleteOldSession) {
             $this->_collection->update(array($this->idColumn => $oldId), array($this->idColumn => $newId), $this->_options);
         } else {
             $row[$this->idColumn] = $newId;
             unset($row['_id']);
             $this->_collection->insert($row, $this->_options);
         }
     }
 }
開發者ID:phiphi1992,項目名稱:alongaydep,代碼行數:24,代碼來源:EMongoHttpSession.php


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