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


PHP Sessions::save方法代碼示例

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


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

示例1: write

 public static function write($session_id, $data)
 {
     // encryption
     $crypt = new Crypt();
     $data = $crypt->encrypt($data);
     $sessions = new Sessions();
     $sessions->session_id = $session_id;
     $sessions->data = $data;
     $s = $sessions->where("session_id = ?", $session_id)->find();
     if (is_null($s)) {
         return $sessions->save();
     }
     $sessions->id = $s->id;
     return $sessions->update();
 }
開發者ID:utumdol,項目名稱:codeseed,代碼行數:15,代碼來源:db_session.class.php

示例2: getSessionId

 public function getSessionId($low = false)
 {
     $real_id = $low ? $this->id . '_low' : $this->id;
     $user_ip = Yii::app()->user->isGuest ? 'none' : Yii::app()->user->user_ip;
     $session = Sessions::model()->findByAttributes(array('ip' => $user_ip, 'real_id' => $real_id), array('select' => 'session_id'));
     if (!$session) {
         $session = new Sessions();
         $session->ip = $user_ip;
         $session->real_id = $real_id;
         $session->user_id = Yii::app()->user->isGuest ? 0 : Yii::app()->user->getId();
         $session_key = Yii::app()->user->isGuest ? md5(time() . 'none' . uniqid()) : Yii::app()->user->session_key;
         $session->session_id = md5($real_id . $session_key);
         $session->save();
     }
     return $session->session_id;
 }
開發者ID:mrtos,項目名稱:OpenNVR,代碼行數:16,代碼來源:Cams.php

示例3: get_session_key

 /**
  * RPC routine to create a session key.
  *
  * @access public
  * @param string $username
  * @param string $password
  * @return string
  */
 public function get_session_key($username, $password)
 {
     if ($this->_doLogin($username, $password)) {
         $this->_jumpStartSession($username);
         $sSessionKey = randomChars(32);
         $session = new Sessions();
         $session->id = $sSessionKey;
         $session->expire = time() + Yii::app()->getConfig('iSessionExpirationTime');
         $session->data = $username;
         $session->save();
         return $sSessionKey;
     } else {
         return array('status' => 'Invalid user name or password');
     }
 }
開發者ID:rawaludin,項目名稱:LimeSurvey,代碼行數:23,代碼來源:remotecontrol.php

示例4: updateSessionDocument

 /**
  * Update session collection
  */
 public function updateSessionDocument($csrfToken = null)
 {
     // get config
     $this->initialize();
     $session = null;
     // get session document
     if (!empty($csrfToken)) {
         $session = Sessions::findFirst(array("conditions" => array("csrfToken" => $csrfToken)));
     }
     if (!empty($session)) {
         // extend session
         $session->expireDate = new MongoDate(strtotime("+6hour"));
         $session->modifiedDate = new MongoDate();
         if ($session->save() == false) {
             foreach ($session->getMessages() as $message) {
                 $this->logger->log(sprintf('NAMESPACE=ControllerBase MESSAGE=%s', $message), \Phalcon\Logger::ERROR);
             }
             return false;
         } else {
             // session record updated successfully
             return $session->csrfToken;
         }
     } else {
         // create session
         $session = new Sessions();
         $session->csrfToken = $this->security->getTokenKey() . $this->security->getToken();
         $session->expireDate = new MongoDate(strtotime("+6hour"));
         $session->createdDate = new MongoDate();
         $session->modifiedDate = new MongoDate();
         if ($session->save() == false) {
             foreach ($session->getMessages() as $message) {
                 $this->logger->log(sprintf('NAMESPACE=ControllerBase MESSAGE=%s', $message), \Phalcon\Logger::ERROR);
             }
             return false;
         } else {
             return $session->csrfToken;
         }
     }
 }
開發者ID:enajeeb,項目名稱:phalcon-rest-boilerplate,代碼行數:42,代碼來源:ControllerBase.php

示例5: array

    // we posted . characters, but something converts them to _ (HTTP 1.1 standard)
    $r = array();
    foreach ($_REQUEST as $i => $v) {
        $r[join('.', explode('_', $i))] = $v;
        //convert _ back to .
    }
    $Sessions = array();
    for ($i0 = 0; isset($r['0.' . $i0]); $i0++) {
        $Sessions[$i0] = array('id' => @$r['0.' . $i0 . '.0'], 'nr' => @$r['0.' . $i0 . '.0'], 'panel' => @$r['0.' . $i0 . '.1'], 'court' => @$r['0.' . $i0 . '.2'], 'city' => @$r['0.' . $i0 . '.3'], 'clerk' => @$r['0.' . $i0 . '.5'], 'scheduled' => @$r['0.' . $i0 . '.6'], 'date of occurence' => @$r['0.' . $i0 . '.7']);
        $Sessions[$i0]['judge'] = array();
        for ($i1 = 0; isset($r['0.' . $i0 . '.4.' . $i1]); $i1++) {
            $Sessions[$i0]['judge'][$i1] = @$r['0.' . $i0 . '.4.' . $i1 . ''];
        }
    }
    $Sessions = new Sessions($Sessions);
    if ($Sessions->save() !== false) {
        die('ok:' . $_SERVER['PHP_SELF']);
    } else {
        die('');
    }
    exit;
    // do not show the interface
}
$buttons = "";
if (isset($_REQUEST['edit'])) {
    $edit = true;
} else {
    $edit = false;
}
$Sessions = new Sessions();
writeHead("<TITLE>Sessions - VIRO - ADL Prototype</TITLE>" . ($edit ? '<SCRIPT type="text/javascript" src="edit.js"></SCRIPT>' : '<SCRIPT type="text/javascript" src="navigate.js"></SCRIPT>') . "\n");
開發者ID:sapray,項目名稱:ampersand-models,代碼行數:31,代碼來源:Sessions.php


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