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


PHP session_decode函数代码示例

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


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

示例1: get_user_id

/**
 * This function returns the user ID of the logged in user on your site.  Technical support will not
 * help you with this for stand-alone installations.  You must purchase the professional installation
 * if you are having trouble.
 *
 * Suggestion: Check out the other integration files in the functions/integrations directory for
 * many examples of how this can be done.  The easiest way is to get the user ID through a cookie.
 *
 * @return the user ID of the logged in user or NULL if not logged in
 */
function get_user_id()
{
    $userid = NULL;
    /*session_name('CAKEPHP');
    		session_start();
    
    		if (isset($_SESSION['userid']))
    		{
    			$userid = $_SESSION['userid'];
    		}*/
    if (isset($_COOKIE['CAKEPHP'])) {
        global $db;
        $result = $db->execute("\n\t\t\t\tSELECT `data`  \n\t\t\t\tFROM `cake_sessions`\n\t\t\t\tWHERE `id` = '" . $_COOKIE['CAKEPHP'] . "'\n\t\t\t");
        if ($result and $db->count_select() > 0) {
            $row = $db->fetch_array($result);
            $session_data = $row['data'];
            session_start();
            session_decode($session_data);
            if (isset($_SESSION['userid'])) {
                $userid = $_SESSION['userid'];
            }
        }
    }
    return $userid;
}
开发者ID:juliushermosura,项目名称:globeloop,代码行数:35,代码来源:integration.php

示例2: LoadSessionByToken

 public function LoadSessionByToken($token)
 {
     $query = sprintf("SELECT sessionid, sessdata FROM [|PREFIX|]sessions WHERE sessionhash='%s'", $GLOBALS['ISC_CLASS_DB']->Quote($token));
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $session = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
     return @session_decode($session['sessdata']);
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:7,代码来源:class.session.php

示例3: buildFiles

 public function buildFiles()
 {
     $ess_usronline = new ess_usronline();
     $ess_usronline->query('DELETE FROM ess_usronline');
     $datSesAct = session_encode();
     $d = dir($session_path = session_save_path());
     while (false !== ($entry = $d->read())) {
         $session_file_name = $session_path . '/' . $entry;
         if (is_readable($session_file_name)) {
             if (is_file($session_file_name)) {
                 $arVarSes = array();
                 $filesize = filesize($session_file_name);
                 if ($filesize > 20) {
                     $_SESSION['datetime'] = $_SESSION['ip'] = $_SESSION['user_id'] = '';
                     $cont = '';
                     $f = fopen($session_file_name, 'r');
                     $cont = fread($f, $filesize);
                     fclose($f);
                     session_decode($cont);
                     if ($_SESSION['user_id'] != "") {
                         $ess_usronline->usuario_id = $_SESSION['user_id'];
                         $ess_usronline->ip = $_SESSION['ip'];
                         $ess_usronline->sesname = $entry;
                         $ess_usronline->size = intval($filesize / 1024);
                         $ess_usronline->filectime = date("Y-m-d H:i:s", filectime($session_file_name));
                         $ess_usronline->datetime = $_SESSION['datetime'];
                         $ess_usronline->save();
                     }
                 }
                 session_decode($datSesAct);
             }
         }
     }
     $d->close();
 }
开发者ID:nextbook438,项目名称:osezno-php-framework,代码行数:35,代码来源:dataModel.php

示例4: write

 function write($sid, $data)
 {
     $time = time();
     $login = date("Y-m-d H:i:s");
     if ($data) {
         $current = $_SESSION;
         session_decode($data);
         $data = $_SESSION["data"];
         $data = $this->db->real_escape_string($data);
         $_SESSION = $current;
     }
     $query = $this->db->query("SELECT data FROM session_holder WHERE id = '{$sid}'");
     $existRow = $query->num_rows;
     $name = $query->fetch_array();
     if ($existRow > 0) {
         if (empty($_POST["login"])) {
             echo "<span class = 'logMsg'>Welcome back, " . $name[0] . "!</span>";
         } else {
             echo "<span class = 'err'>You have logged in already as " . $name[0] . ".</span>";
         }
     } else {
         if (!empty($data)) {
             $this->result = $this->db->query("INSERT INTO session_holder VALUES('{$sid}', '{$time}', '{$data}', '{$login}')") or die("Cannot login.");
             echo "<span class = 'logMsg'>Log in successful. \n\t\t\t    Session should last " . $this->maxlifetime / 60 . " minutes. \n\t\t\t    See the new Log History here: <a href = " . $_SERVER['REQUEST_URI'] . "> View Log</a></span>";
         }
     }
     return true;
 }
开发者ID:amychan331,项目名称:schoolProject-EduGarden,代码行数:28,代码来源:a05.php

示例5: write

 /**
  * Write the session data, convert to json before storing
  * @param string $id The SESSID to save
  * @param string $data The data to store, already serialized by PHP
  * @return boolean True if memcached was able to write the session data
  */
 public function write($id, $data)
 {
     $tmp = $_SESSION;
     session_decode($data);
     $new_data = $_SESSION;
     $_SESSION = $tmp;
     return $this->memcache->set("sessions/{$id}", json_encode($new_data), 0, $this->lifetime);
 }
开发者ID:kerrer,项目名称:vagrant,代码行数:14,代码来源:memcacheSessionHandler.php

示例6: get

 /**
  * Get information on a session.
  * 
  * @param string $id A session id.
  * 
  * @return array The session variables.
  */
 public function get($id)
 {
     $realSession = $_SESSION;
     session_decode($this->redis->get(self::PREFIX . $id));
     $userSession = $_SESSION;
     $_SESSION = $realSession;
     return $userSession;
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:15,代码来源:redissession.php

示例7: read

 /**
  * {@inheritdoc}
  */
 public function read($sessionId)
 {
     $sessionData = Cache::read($sessionId, Configure::read('Session.handler.config'));
     session_decode($sessionData);
     $restoredSessionData = $_SESSION;
     foreach ($_SESSION as $key => $value) {
         unset($_SESSION[$key]);
     }
     return serialize($restoredSessionData);
 }
开发者ID:schnauss,项目名称:Ratchet,代码行数:13,代码来源:CakeWampSessionHandler.php

示例8: handleLogout

 /**
  * Delete sessions with given userId and deviceId.
  * 
  * @see Rublon2FactorCallback::handleLogout()
  */
 protected function handleLogout($userId, $deviceId)
 {
     foreach (glob(ini_get('session.save_path') . "/sess_*") as $file) {
         $contents = @file_get_contents($file);
         session_decode($contents);
         if (!empty($_SESSION['user']) and !empty($_SESSION['user']['login']) and $_SESSION['user']['login'] == $userId and (empty($_SESSION['rublonDeviceId']) or $_SESSION['rublonDeviceId'] == $deviceId)) {
             unlink($file);
         }
     }
 }
开发者ID:rublon,项目名称:rublon-sdk-php,代码行数:15,代码来源:MyCallback.php

示例9: write

 /**
  * Write the session data, convert to json before storing
  * @param string $id The SESSID to save
  * @param string $data The data to store, already serialized by PHP
  * @return boolean True if redis was able to write the session data
  */
 public function write($id, $data)
 {
     $tmp = $_SESSION;
     session_decode($data);
     $new_data = $_SESSION;
     $_SESSION = $tmp;
     $this->redis->set("sessions/{$id}", json_encode($new_data));
     $this->redis->expire("sessions/{$id}", $this->lifetime);
     return true;
 }
开发者ID:kerrer,项目名称:vagrant,代码行数:16,代码来源:redisSessionHandler.php

示例10: ms_read

function ms_read($sessid)
{
    $result = executeQuery("SELECT * FROM currentsession WHERE sessionID='{$sessid}'");
    if ($row = $result->firstrow()) {
        session_decode($row["variables"]);
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:hexerei-software,项目名称:XOX-Framework,代码行数:10,代码来源:sessions.php

示例11: write

 /**
  * Writes Session json_encoded, so we can access the Session data with other clients like node.js
  */
 public function write($id, $data)
 {
     $tmp = $_SESSION;
     session_decode($data);
     $new_data = $_SESSION;
     $_SESSION = $tmp;
     $id = $this->redisKeyPath() . $id;
     $this->client->set($id, json_encode($new_data));
     $this->client->expire($id, $this->ttl);
     return true;
 }
开发者ID:swilsonalfa,项目名称:TrafficAdvisor,代码行数:14,代码来源:RedisSessionHandler.php

示例12: testGetPDOSession

 public function testGetPDOSession()
 {
     $session = new \Reservat\Session\Session($this->di, 'PDO');
     session_id('k4o6898jdru8e8gah9mkv5fss5');
     //session_decode($this->sessionData);
     $handler = $session->getHandler();
     session_decode($handler->read('k4o6898jdru8e8gah9mkv5fss5'));
     $this->assertEquals($session->get('ohhai'), 1);
     $this->assertEquals($session->get('userId'), 14);
     $rawSession = $handler->getRaw(session_id());
     $this->assertEquals($rawSession->getUserId(), 14);
 }
开发者ID:reservat,项目名称:session,代码行数:12,代码来源:SessionTest.php

示例13: testGateKeeperCheckBasic

 public function testGateKeeperCheckBasic()
 {
     /* Set our stored DB session MANUALLY for testing */
     session_id('k4o6898jdru8e8gah9mkv5fss5');
     $handler = $this->di->get('session')->getHandler();
     session_decode($handler->read('k4o6898jdru8e8gah9mkv5fss5'));
     $gateway = new \Reservat\Auth\GateKeeper($this->di, $this->manager, 'Basic');
     $result = $gateway->check();
     if ($result['Basic']) {
         $user = $result['Basic']->getUser();
         $this->assertEquals($user->getUsername(), 'abc');
     }
 }
开发者ID:reservat,项目名称:auth,代码行数:13,代码来源:AuthGateKeeperTest.php

示例14: load

 public final function load($session_id)
 {
     $string = $this->_load($session_id);
     if (!is_string($string) && $string !== false) {
         Mage::throwException('_load should return a string or false');
     }
     if (!$this->_decodeData) {
         return;
     }
     if ($string) {
         session_decode($string);
     } else {
         $_SESSION = array();
     }
 }
开发者ID:asavchenko,项目名称:Magento_CrossAreaSessions,代码行数:15,代码来源:Abstract.php

示例15: hookExpiredSession

 public static function hookExpiredSession($sessionContents)
 {
     if (session_decode($sessionContents)) {
         if (Zend_Auth::getInstance()->hasIdentity()) {
             $identity = Zend_Auth::getInstance()->getIdentity();
             $audit = new Audit();
             $audit->objectClass = 'Logout';
             $audit->userId = (int) $identity->personId;
             $audit->message = __('user') . ': ' . $identity->username . ' ' . __('was logged out due to session expiration');
             $audit->dateTime = date('Y-m-d H:i:s');
             $audit->_ormPersist = true;
             $audit->persist();
         }
     }
 }
开发者ID:lucianobenetti,项目名称:clearhealth,代码行数:15,代码来源:Logout.php


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