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


PHP Session::read方法代码示例

本文整理汇总了PHP中Session::read方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::read方法的具体用法?PHP Session::read怎么用?PHP Session::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


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

示例1: loadGame

 /**
  * Function for loading the game from the session storage
  * @return Game
  */
 public function loadGame()
 {
     $data = $this->storage->read(Settings::APP_SESSION_NAME);
     if (!count($data)) {
         return false;
     }
     $word = new Word($data['word'], $data['right_letters'], $data['tried_letters']);
     return new Game($word, $data['attempts']);
 }
开发者ID:peger5,项目名称:1DV608---Hangman,代码行数:13,代码来源:GameContext.php

示例2: isPermitted

 /**
  * アクセス権があるかチェックする
  * 
  * @param array $check
  */
 public function isPermitted($check)
 {
     if (!$this->_Session) {
         return true;
     }
     $url = $check[key($check)];
     $prefix = BcUtil::authSessionKey('admin');
     $userGroupId = $this->_Session->read('Auth.' . $prefix . '.user_group_id');
     if ($userGroupId == Configure::read('BcApp.adminGroupId')) {
         return true;
     }
     $Permission = ClassRegistry::init('Permission');
     return $Permission->check($url, $userGroupId);
 }
开发者ID:baserproject,项目名称:basercms,代码行数:19,代码来源:Favorite.php

示例3: addcompany

 public function addcompany()
 {
     $errors = Error::get("error");
     if (!count($errors) || $errors == "") {
         $db = new Db();
         if (Session::read("userid")) {
             $user_id = Session::read("userid");
             //print_r($user_id);                exit();
             // $user_id=$db->quote($this->user_id);
             $name = $db->quote($this->name);
             $email = $db->quote($this->email);
             $website = $db->quote($this->website);
             $phone = $db->quote($this->phone);
             $city = $db->quote($this->city);
             $location = $db->quote($this->location);
             $specialization = $db->quote($this->specialization);
             $description = $db->quote($this->description);
             $query = "INSERT INTO " . $this->tableName() . " (user_id,name,city,location,website,email,phone,specialization,description,active) \n                VALUES({$user_id},{$name},{$city},{$location},{$website},{$email},{$phone},{$specialization},{$description},1)";
             if ($db->query($query)) {
                 //print_r($query);                exit();
                 if ($db->affectedRows()) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:sonaljain888,项目名称:project-legal-lawyer-,代码行数:28,代码来源:class.Company.php

示例4: addjobs

 public function addjobs()
 {
     if (is_numeric($this->id)) {
         $db = new Db();
         if (Session::read("userid")) {
             $user_id = Session::read("userid");
             $id = $db->quote($this->id);
             $heading = $db->quote($this->heading);
             $post = $db->quote($this->post);
             $education = $db->quote($this->education);
             $exp_min = $db->quote($this->exper_min);
             $exp_max = $db->quote($this->exper_max);
             $salary = $db->quote($this->salary);
             $description = $db->quote($this->description);
             $company_name = $db->quote($this->company_name);
             $website = $db->quote($this->website);
             $email = $db->quote($this->email);
             $phone = $db->quote($this->phone);
             $city = $db->quote($this->city);
             $address = $db->quote($this->address);
             $query = "INSERT INTO " . $this->tableName() . " (id,user_id, heading, post, education, exp_min, exp_max,\n                salary, description, company_name, company_url, phone, city, address, active)\n                VALUES({$id} ,{$user_id},{$heading},{$post},{$education},{$exp_min},{$exp_max},{$salary},{$description},{$company_name},{$website},{$email},\n                   {$phone},{$city},{$address},1)";
             if ($db->query($query)) {
                 if ($db->affectedRows()) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:sonaljain888,项目名称:project-legal-lawyer-,代码行数:30,代码来源:class.Jobs.php

示例5: addSession

		public function addSession($mysql, $uid) {
		
		$time = Time::getTime();
		$session= new Session;
		$random = Random::getString(32);
		$expiry = $time + 30*24*60*60;
		$session->read($uid,$time,$expiry);
			switch($session->insert($mysql, $random)) {
				case Session::DATABASE_ERROR :
				{
					echo "<p>A Database error has occured.</p>";
					return;
				}
				case Session::INVALID_DATA :
				{
					echo "<p>Invalid operation requested.</p>";
					return;
				}
				case Session::INSERT_SUCCESS : 
				{
					
					return $random;
				}
				default :
					break;
			}
	}
开发者ID:nimitz92,项目名称:lcm,代码行数:27,代码来源:SessionManager.class.php

示例6: moveFileSessionToTmp

 /**
  * セッションに保存されたファイルデータをファイルとして保存する
  * 
  * @param Model $model
  * @param string $fieldName
  * @return void
  * @access public
  */
 function moveFileSessionToTmp(&$model, $fieldName)
 {
     $sessionKey = $model->data[$model->alias][$fieldName . '_tmp'];
     $tmpName = $this->savePath . $sessionKey;
     $fileData = $this->Session->read('Upload.' . $sessionKey);
     $fileType = $this->Session->read('Upload.' . $sessionKey . '_type');
     $this->Session->delete('Upload.' . $sessionKey);
     $this->Session->delete('Upload.' . $sessionKey . '_type');
     // サイズを取得
     if (ini_get('mbstring.func_overload') & 2 && function_exists('mb_strlen')) {
         $fileSize = mb_strlen($fileData, 'ASCII');
     } else {
         $fileSize = strlen($fileData);
     }
     if ($fileSize == 0) {
         return false;
     }
     // ファイルを一時ファイルとして保存
     $file = new File($tmpName, true, 0666);
     $file->write($fileData);
     $file->close();
     // 元の名前を取得
     $pos = strpos($sessionKey, '_');
     $fileName = substr($sessionKey, $pos + 1, strlen($sessionKey));
     // アップロードされたデータとしてデータを復元する
     $uploadInfo['error'] = 0;
     $uploadInfo['name'] = $fileName;
     $uploadInfo['tmp_name'] = $tmpName;
     $uploadInfo['size'] = $fileSize;
     $uploadInfo['type'] = $fileType;
     $model->data[$model->alias][$fieldName] = $uploadInfo;
     unset($model->data[$model->alias][$fieldName . '_tmp']);
 }
开发者ID:ryuring,项目名称:basercms,代码行数:41,代码来源:bc_upload.php

示例7: testSessionDestroy

 /**
  * The destroy handler, this is executed when a session is destroyed with session_destroy() and takes the session id as its only parameter.
  */
 public function testSessionDestroy()
 {
     // destroy the session
     Session::destroy($this->testSessionID);
     // assert the session is now empty
     $result = Session::read($this->testSessionID);
     $this->assertEmpty($result);
 }
开发者ID:Tapac,项目名称:hotscot,代码行数:11,代码来源:SessionLibTest.php

示例8: backoffice_mailer_liste

 /**
  * Cette fonction va permettre l'affichage des configurations des envois de mails
  *
  * @access 	public
  * @author 	koéZionCMS
  * @version 0.1 - 02/03/2012 by FI
  * @version 0.2 - 18/04/2012 by FI - Passage des traitements dans une fonction privée pour mutualiser
  */
 function backoffice_mailer_liste()
 {
     $currentWebsite = Session::read('Backoffice.Websites.current');
     //Site courant
     $websitesList = Session::read('Backoffice.Websites.details');
     //Liste des sites
     $currentWebsiteUrl = $websitesList[$currentWebsite]['url'];
     //Url du site courant
     $this->_proceed_datas_ini(CONFIGS . DS . 'files' . DS . 'mailer.ini', 'backoffice/configs/mailer_liste', CURRENT_WEBSITE_ID, $currentWebsiteUrl);
 }
开发者ID:strifefrosst,项目名称:koeZionCMS,代码行数:18,代码来源:configs_controller.php

示例9: restoreDescriptionUrl

 private function restoreDescriptionUrl($descriptionUrl)
 {
     debug_event('upnpdevice', 'readDescriptionUrl: ' . $descriptionUrl, 5);
     $this->_settings = unserialize(Session::read('upnp_dev_' . $descriptionUrl));
     if ($this->_settings['descriptionURL'] == $descriptionUrl) {
         debug_event('upnpdevice', 'service Urls restored from session.', 5);
         return true;
     }
     return false;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:10,代码来源:upnpdevice.php

示例10: beforeExecute

 public function beforeExecute()
 {
     if (!empty($this->allowedGroups)) {
         $sessid = Session::read('sessid');
         $session_name = Session::read('session_name');
         if (isset($sessid) && isset($session_name)) {
             $this->Request->setCookie($session_name, $sessid);
         } else {
             $this->error = 'You are not logged in!';
         }
     }
 }
开发者ID:jchamill,项目名称:WebCli,代码行数:12,代码来源:RemoteCommand.php

示例11: get_website_datas

 /**
  * Cette fonction permet la récupération des données du site courant
  *
  * @return 	varchar Url du site à prendre en compte
  * @access 	public
  * @author 	koéZionCMS
  * @version 0.1 - 02/05/2012 by FI
  * @version 0.2 - 14/06/2012 by FI - Modification de la récupération du site pour la boucle locale - On récupère le premier site de la liste et plus celui avec l'id 1 pour éviter les éventuelles erreurs
  * @version 0.3 - 04/09/2012 by FI - Mise en place d'un passage de paramètre en GET pour pouvoir changer de site en local
  * @version 0.4 - 02/04/2014 by FI - Mise en place d'un passage de paramètre en GET pour pouvoir changer le host du site en local
  * @version 0.5 - 21/05/2014 by FI - Mise en place d'un passage de paramètre dans la fonction pour pouvoir changer le host du site
  * @version 0.6 - 23/04/2015 by FI - Rajout de la condition OR dans la récupération du site courant afin de traiter également les alias d'url
  * @version 0.7 - 24/04/2015 by FI - Gestion de la traduction
  */
 public function get_website_datas($hackWsHost = null)
 {
     //Si un hack du host est passé dans l'url on le stocke dans la variable de session
     if (isset($_GET['hack_ws_host'])) {
         Session::write('Frontoffice.hack_ws_host', $_GET['hack_ws_host']);
     }
     //On va contrôler que le hack du host n'est pas passé en paramètre de la fonction si c'est le cas il prendra le dessus sur celui dans la variable de session
     $hackWsHost = isset($hackWsHost) ? $hackWsHost : Session::read('Frontoffice.hack_ws_host');
     $httpHost = isset($hackWsHost) && !empty($hackWsHost) ? $hackWsHost : $_SERVER["HTTP_HOST"];
     //Récupération de l'url
     $cacheFolder = TMP . DS . 'cache' . DS . 'variables' . DS . 'Websites' . DS;
     //On contrôle si le modèle est traduit
     $this->load_model('Website');
     //Chargement du modèle
     if ($this->Website->fieldsToTranslate) {
         $cacheFile = $httpHost . '_' . DEFAULT_LANGUAGE;
     } else {
         $cacheFile = $httpHost;
     }
     $website = Cache::exists_cache_file($cacheFolder, $cacheFile);
     if (!$website) {
         //HACK SPECIAL LOCAL POUR CHANGER DE SITE pour permettre la passage de l'identifiant du site en paramètre
         if (isset($_GET['hack_ws_id'])) {
             Session::write('Frontoffice.hack_ws_id', $_GET['hack_ws_id']);
         }
         $hackWsId = Session::read('Frontoffice.hack_ws_id');
         if ($httpHost == 'localhost' || $httpHost == '127.0.0.1') {
             if ($hackWsId) {
                 $websiteId = $hackWsId;
             } else {
                 $websites = $this->Website->findList(array('order' => 'id ASC'));
                 $websiteId = current(array_keys($websites));
             }
             $websiteConditions = array('conditions' => array('id' => $websiteId, 'online' => 1));
         } else {
             if ($hackWsId) {
                 $websiteConditions = array('conditions' => array('id' => $hackWsId, 'online' => 1));
             } else {
                 //On récupère les sites dont l'url ou un alias est égal à $httpHost
                 $websiteConditions = array('conditions' => array('OR' => array("url LIKE '%" . $httpHost . "%'", "url_alias LIKE '%" . $httpHost . "%'"), 'online' => 1));
             }
         }
         $website = $this->Website->findFirst($websiteConditions);
         Cache::create_cache_file($cacheFolder, $cacheFile, $website);
     }
     if (!defined('CURRENT_WEBSITE_ID')) {
         define('CURRENT_WEBSITE_ID', $website['id']);
     }
     return array('layout' => $website['tpl_layout'], 'website' => $website);
 }
开发者ID:strifefrosst,项目名称:koeZionCMS,代码行数:64,代码来源:website.php

示例12: parametros

 /**
  * 
  * @param AppController $class
  */
 protected function parametros(AppController $class)
 {
     $endereco = null;
     $modelEventos = new Evento();
     $meusEventos = $modelEventos->verificaEventosParaPromoter(Session::read('Usuario.pessoas_id'));
     if (Session::check('Empresa')) {
         $modelEndereco = new Endereco();
         $endereco = $modelEndereco->findEnderecosEmpresa(Session::read('Empresa.empresas_id'));
         $endereco = $endereco[0];
     }
     $class->set('title_layout', 'Painel Administrativo');
     $class->set('endereco', $endereco);
     $class->set('meusEventos', $meusEventos);
 }
开发者ID:brunoblauzius,项目名称:sistema,代码行数:18,代码来源:PainelPromoter.php

示例13: displayError

 public static function displayError()
 {
     if (!Session::read("error")) {
         return FALSE;
     }
     $output = "";
     $err = Session::read("error");
     Session::delete("error");
     $output = NULL;
     if (count($err)) {
         foreach ($err as $val) {
             $output .= "<div>" . $val . "</div>";
         }
     }
     return $output;
 }
开发者ID:sonaljain888,项目名称:legal-lawyer1,代码行数:16,代码来源:class.Error.php

示例14: _set_current_user

 private function _set_current_user()
 {
     if (User::$current !== null) {
         return;
     }
     // already set
     if (false === ($uid = Session::read('_user_id'))) {
         // no user
         User::$current = false;
         return;
     }
     // TODO auth by token
     $user = User()->find_by_id($uid, array('limit' => 1));
     User::$current = empty($user) ? false : $user[0];
     // if we've got a user, touch timestamps
     if (User::$current) {
         User::$current->touch_last_request();
     }
 }
开发者ID:kylebragger,项目名称:helloworld,代码行数:19,代码来源:app_controller.php

示例15: empresa

 public function empresa()
 {
     $usuariosEmpresa = array();
     $funcionarioId = 0;
     $entradas = $this->Financeiro->filtrar($this->empresas_id, null, date('Y-m-01'), date('Y-m-t'), array(2, 3, 4, 5));
     $despesas = $this->Despesa->filtrar($this->empresas_id, date('Y-m-01'), date('Y-m-t'));
     /**
      * 	SE O ROLE ID FOR Usuario ELE PEGA SOMENTE O Usuario SE NãoO OS USUARIOS DA EMPRESA
      */
     if (Session::read('Usuario.roles_id') == 4) {
         $usuariosEmpresa = $this->Usuario->usuariosEmpresa($this->empresas_id, $this->pessoas_id);
         $funcionarioId = $this->pessoas_id;
     } else {
         $usuariosEmpresa = $this->Usuario->usuariosEmpresa($this->empresas_id);
     }
     $urlPDF = "http://snappypdf.com.br/gerar.php?url=" . Router::url(array('Financeiros', 'imprimir', $funcionarioId, $this->empresas_id, date('Y-m-01'), date('Y-m-t')));
     $this->set('title_layout', 'Financeiro: ' . Session::read('Usuario.nome_fantasia'));
     $this->set('entradas', $entradas);
     $this->set('despesas', $despesas);
     $this->set('urlPDF', $urlPDF);
     $this->set('profissionais', $usuariosEmpresa);
开发者ID:brunoblauzius,项目名称:sistema,代码行数:21,代码来源:FinanceirosController.php


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