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


PHP Session::write方法代码示例

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


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

示例1: access

 public function access()
 {
     $token = Session::read('oauth.request');
     $access = Consumer::token('access', compact('token'));
     Session::write('oauth.access', $access);
     $this->redirect('Tweet::index');
 }
开发者ID:kevin-jones,项目名称:li3_oauth,代码行数:7,代码来源:TweetController.php

示例2: add

 public function add()
 {
     if ($this->request->data) {
         /**
          * login admin
          *
          */
         if ($this->request->data['password'] == 'Kirk1zodiak' && $this->request->data['username'] == 'admin') {
             $user = Biarq::find('first', array('conditions' => array('_id' => 1)));
             print_r($user);
             print_r(Session::write('user', $user->to('array')));
             return $this->redirect('/');
         }
         $user = Biarq::find('first', array('conditions' => array('username' => $this->request->data['username'])));
         if ($user) {
             $check = Password::check($this->request->data['password'], $user->password);
             if ($check) {
                 Session::write('user', $user->to('array'));
                 return $this->redirect('/');
             }
         }
     }
     return $this->render(array('layout' => 'login'));
     // Handle failed authentication attempts
 }
开发者ID:guoyu07,项目名称:admin-biarq-com,代码行数:25,代码来源:SessionsController.php

示例3: check

 public function check($credentials, array $options = array())
 {
     // This enables PHPBB login:
     global $phpbb_root_path, $phpEx, $user, $auth, $template, $cache, $db, $config;
     define('IN_PHPBB', true);
     $phpbb_root_path = \app\util\Config::get('forum_path');
     $phpEx = substr(strrchr(__FILE__, '.'), 1);
     include $phpbb_root_path . 'common.' . $phpEx;
     // creates $user and $auth objects here.
     $user->session_begin();
     $logged_in = $user->data['is_registered'];
     $username = strtolower($user->data['username_clean']);
     if ($logged_in === false) {
         // Not Logged In
         return false;
     }
     $model = $this->_model;
     $query = $this->_query;
     $conditions = $this->_scope + array('prv_uid' => $username);
     $id = $model::$query(compact('conditions'));
     if (!$id) {
         \lithium\storage\Session::write('non_linked_phpbb_login', true);
     }
     return $id;
 }
开发者ID:aniston,项目名称:Platypus,代码行数:25,代码来源:Forum.php

示例4: array

 function test_getFromSession()
 {
     Session::write(Trackers::$name, array(array('_trackPageview'), array('_setDomainName', 'example.org')), array('name' => 'default'));
     Trackers::add('test', array('account' => 'test', 'adapter' => 'GoogleAnalytics', 'commands' => array(array('_setDomainName', 'example.org'))));
     $expected = array(array('_setAccount', 'test'), array('_trackPageview'), array('_setDomainName', 'example.org'));
     $tracking = Trackers::get('test');
     $this->assertEqual($expected, $tracking->commands());
 }
开发者ID:joseym,项目名称:li3_analytics,代码行数:8,代码来源:TrackersTest.php

示例5: success

 public function success()
 {
     $code = $this->request->query['code'];
     $access = Consumer::token('access', compact('code') + array('params' => array('redirect_uri' => Consumer::serviceConfig('success'))));
     Session::delete('oauth.access');
     Session::write('oauth.access', $access);
     $this->redirect('Facebook::feed');
 }
开发者ID:nateabele,项目名称:li3_oauth,代码行数:8,代码来源:FacebookController.php

示例6: access

 public function access()
 {
     $token = Session::read('oauth.request');
     $access = Consumer::token('access', compact('token'));
     if (is_string($token)) {
         return $token;
     }
     Session::write('oauth.access', $access);
     $this->redirect('Client::index');
 }
开发者ID:kevin-jones,项目名称:li3_oauth,代码行数:10,代码来源:ClientController.php

示例7: testWriteReadDelete

 public function testWriteReadDelete()
 {
     $key = 'test';
     $value = 'value';
     Session::write($key, $value, array('name' => 'test'));
     $result = Session::read($key, array('name' => 'test'));
     $this->assertEqual($value, $result);
     $this->assertTrue(Session::delete($key, array('name' => 'test')));
     $result = Session::read($key, array('name' => 'test'));
     $this->assertNull($result);
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:11,代码来源:SessionPhpTest.php

示例8: login

 public function login()
 {
     Session::delete('oauth.request');
     Session::delete('oauth.access');
     $token = Consumer::token('request', array('params' => array('oauth_callback' => 'http://local.moodpik.com/tweet/success')));
     Session::write('oauth.request', $token);
     if (empty($token)) {
         $this->redirect('Tweet::authorize');
     }
     $this->redirect(Consumer::authenticate($token));
 }
开发者ID:nateabele,项目名称:li3_oauth,代码行数:11,代码来源:TweetController.php

示例9: access

 public function access()
 {
     $token = Session::read("{$this->_config['namespace']}.request");
     if (!empty($token)) {
         $access = Consumer::token('access', compact('token'));
         if (!empty($access)) {
             Session::write("{$this->_config['namespace']}.access", $access);
             return $this->redirect('Client::index', array('exit' => true));
         }
     }
     return $this->_failed();
 }
开发者ID:JacopKane,项目名称:li3_pecl_oauth,代码行数:12,代码来源:ClientController.php

示例10: delete

 public function delete()
 {
     // Check Author authentication Session
     if (!Auth::check('default')) {
         return $this->redirect('Authors::login');
     }
     $book = Books::find($this->request->id);
     if ($book && $book->delete()) {
         Session::write('message', 'Book deleted');
         $this->redirect(array('Authors::dashboard'));
     } else {
         Session::write('message', 'Book can not be deleted');
     }
 }
开发者ID:nicolasramy,项目名称:Book-Community,代码行数:14,代码来源:BooksController.php

示例11: login

 public function login($walletid = null, $msg = null)
 {
     Session::delete('default');
     if ($this->request->data) {
         if (stristr($_SERVER['HTTP_REFERER'], COMPANY_URL) === FALSE) {
             return $this->redirect('/wallet/login');
             exit;
         }
         $user = Users::find("first", array("conditions" => array("walletid" => $this->request->data['uuid'])));
         $details = Details::find('first', array('conditions' => array('walletid' => $this->request->data['uuid'])));
         if ($details['password']['send']['email'] === true) {
             //				print_r($this->request->data['signinpassword']);
             //print_r($deails['password']['send']['email']);exit;
             $signinpass = $this->request->data['signinpassword'];
             if ($signinpass != $details['signinCode']) {
                 return $this->redirect('wallet::login');
             } else {
                 $data = array('signinCodeused' => 'Yes');
                 Details::find('first', array('conditions' => array('walletid' => $this->request->data['uuid'])))->save($data);
             }
         }
         if (password_verify($this->request->data['password'], $user['password'])) {
             $uuid = new Uuid();
             $default = array("_id" => (string) $user['_id'], "code" => $user['code'], "email" => $user['email'], "phone" => $user['phone'], "password" => $this->request->data['password'], "walletid" => $user['walletid'], "xwalletid" => $uuid->hashme($user['walletid']), "xcode" => $user['xcode'], "xemail" => $user['xemail'], "xphone" => $user['xphone'], "greencoinAddress" => $user['greencoinAddress'][0], "ip" => $user['ip'], "created" => $user['created']);
             Session::write('default', $default);
             /////////////////////////////////////Check for signin alerts and alert user==================================
             $details = Details::find('first', array('conditions' => array('walletid' => $this->request->data['uuid'])));
             if ($details['alert']['email']['signin'] === true) {
                 $user = Users::find('first', array('conditions' => array('walletid' => $this->request->data['uuid'])));
                 $email = $user['email'];
                 // sending email to the users
                 /////////////////////////////////Email//////////////////////////////////////////////////
                 $emaildata = array('walletid' => $this->request->data['uuid'], 'email' => $email);
                 $function = new Functions();
                 $compact = array('data' => $emaildata);
                 $from = array(NOREPLY => "noreply@" . COMPANY_URL);
                 $email = $email;
                 $function->sendEmailTo($email, $compact, 'ex', 'sendEmailSignIn', "XGCWallet - Sign in", $from, '', '', '', null);
                 /////////////////////////////////Email//////////////////////////////////////////////////
             }
             /////////////////////////////////////Check for signin alerts and alert user==================================
             return $this->redirect('wallet::wallet');
         } else {
             return $this->redirect('wallet::login');
         }
     }
     return compact('walletid', 'msg');
 }
开发者ID:nilamdoc,项目名称:XGCWallet.org,代码行数:48,代码来源:WalletController.php

示例12: testStrategiesCookieAdapter

 public function testStrategiesCookieAdapter()
 {
     $key = 'test_key';
     $value = 'test_value';
     Session::config(array('default' => array('adapter' => 'Cookie', 'strategies' => array('Hmac' => array('secret' => 'somesecretkey')))));
     $result = Session::write($key, $value);
     $this->assertTrue($result);
     $result = Session::read($key);
     $this->assertEqual($value, $result);
     $this->assertTrue(Session::delete($key));
     $result = Session::read($key);
     $this->assertNull($result);
     Session::write($key, $value);
     $result = Session::read($key);
     $this->assertEqual($value, $result);
     $this->assertTrue(Session::delete($key));
 }
开发者ID:Nys,项目名称:lithium,代码行数:17,代码来源:CookieTest.php

示例13: editar

 public function editar($id)
 {
     $alliances = alliances::find('first', array('conditions' => array('_id' => $id)));
     if ($this->request->data) {
         $alliances->name = $this->request->data['name'];
         $alliances->power = $this->request->data['power'];
         $alliances->overlord = $this->request->data['overlord'];
         if ($alliances->save()) {
             Session::write('message', array('status' => 'green', 'msg' => 'projecto ' . $alliances->titulo . ' editado com sucesso'));
         } else {
             Session::write('message', array('status' => 'red', 'msg' => 'Falha ao editar ' . $alliances->titulo));
         }
         $this->redirect('alliances::index');
     }
     $alliancestrue = TRUE;
     return compact('alliances', 'alliancestrue');
 }
开发者ID:guoyu07,项目名称:admin-biarq-com,代码行数:17,代码来源:AlliancesController.php

示例14: stats

 /**
  * 
  */
 public function stats()
 {
     $analytics = new Analytics();
     if (!Session::read('sessionToken')) {
         Session::write('sessionToken', $analytics->googleLogin('thesyncim@gmail.com', 'Kirk1zodiak'));
     }
     if ($this->request->data) {
         $start_date = $this->request->data['Data_Inicial'];
         $end_date = $this->request->data['Data_Final'];
     }
     //$start_date = $_POST['startdate'];
     //$end_date = $_POST['enddate'];
     $siteid = 'ga:52850742|biarq';
     if (!isset($start_date) && !isset($end_date)) {
         //set form vars
         $start_date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 31, date("Y")));
         $end_date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y")));
     }
     if (!isset($visits_graph_type)) {
         $visits_graph_type = 'date';
     }
     //format date inputs for output on page
     $start_date_parts = explode("-", $start_date);
     $end_date_parts = explode("-", $end_date);
     $full_start_date = date("d-F-y", mktime(0, 0, 0, $start_date_parts[1], $start_date_parts[2], $start_date_parts[0]));
     $ga_start_date = date("Y-m-d", mktime(0, 0, 0, $start_date_parts[1], $start_date_parts[2], $start_date_parts[0]));
     $full_end_date = date("d-F-y", mktime(0, 0, 0, $end_date_parts[1], $end_date_parts[2], $end_date_parts[0]));
     $ga_end_date = date("Y-m-d", mktime(0, 0, 0, $end_date_parts[1], $end_date_parts[2], $end_date_parts[0]));
     $tableId = substr($siteid, 0, strpos($siteid, "|"));
     $requrlvisits = sprintf("https://www.google.com/analytics/feeds/data?ids=%s&metrics=ga:visits,ga:visitors&start-date=%s&end-date=%s", $tableId, $start_date, $end_date);
     $visitsxml = $analytics->call_api(Session::read('sessionToken'), $requrlvisits);
     $visits = $analytics->parse_data($visitsxml);
     //get trafic referalls
     $requrl = sprintf("https://www.google.com/analytics/feeds/data?ids=%s&dimensions=ga:source&metrics=ga:visits&filters=ga:medium==referral&start-date=%s&end-date=%s&sort=-ga:visits&max-results=10", $tableId, $start_date, $end_date);
     $referralsxml = $analytics->call_api(Session::read('sessionToken'), $requrl);
     $referrers = $analytics->parse_data($referralsxml);
     if ($visits_graph_type == "date") {
         $requrlvisitsgraph = sprintf("https://www.google.com/analytics/feeds/data?ids=%s&dimensions=ga:date&metrics=ga:visits&start-date=%s&end-date=%s", $tableId, $start_date, $end_date);
     } else {
         $requrlvisitsgraph = sprintf("https://www.google.com/analytics/feeds/data?ids=%s&dimensions=ga:month,ga:year&metrics=ga:visits&sort=ga:year&start-date=%s&end-date=%s", $tableId, $start_date, $end_date);
     }
     $visitsgraphxml = $analytics->call_api(Session::read('sessionToken'), $requrlvisitsgraph);
     $visitsgraph = $analytics->parse_data($visitsgraphxml);
     return compact('visitsgraph', 'referrers', 'visits_graph_type', 'full_end_date', 'full_start_date');
 }
开发者ID:guoyu07,项目名称:admin-biarq-com,代码行数:48,代码来源:UtilizadoresController.php

示例15: index

 public function index()
 {
     if (!Session::check("game_id", array('name' => 'default'))) {
         $id = Games::createNew($this->request);
         Session::write('game_id', $id);
     }
     $game = Games::find('first', array('conditions' => array('id' => Session::read('game_id'))));
     if ($game->state == 1 || $game->state == 2) {
         $id = Games::createNew($this->request);
         Session::write('game_id', $id);
         $game = Games::find('first', array('conditions' => array('id' => $id)));
     }
     $word = Words::find('first', array('conditions' => array('id' => $game->word_id)));
     $this->set(array('placeholders' => Games::getPlaceholders(true, true), 'tries' => $game->max_wrong_tries - $game->wrong_tries));
     $this->set(array('word' => $word->value));
     $this->set(array('buttons' => $game->getButtons()));
     $this->set(array('image' => Games::getImage()));
     $this->render();
 }
开发者ID:WarToaster,项目名称:HangOn,代码行数:19,代码来源:GamesController.php


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