当前位置: 首页>>代码示例>>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;未经允许,请勿转载。