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


PHP Session::delete方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: login

 public function login()
 {
     $result = Auth::check($this->request->adapter, $this->request);
     $redirectUrl = $this->request->env('HTTP_REFERER') ?: '/';
     if ($result) {
         # Convert array to identity object
         if ($this->request->adapter === 'password') {
             $result = Identities::find($result['_id']);
         }
         $session_data = array();
         $new_session = uniqid();
         if (isset($result['session']['id'])) {
             $session_data['id'] = (array) $result['session']['id']->data();
         } else {
             $session_data['id'] = array();
         }
         // Remember users for two weeks
         $session_data['expires'] = time() + \app\util\Config::get('session_length', 7) * 24 * 60 * 60;
         array_push($session_data['id'], $new_session);
         setcookie('session.id', $new_session, $session_data['expires'], '/', $_SERVER['HTTP_HOST']);
         $result->save(array('session' => $session_data));
         Auth::set('any', $result);
     } else {
         $addendum = '';
         // Adapter-specific error messages
         if ($this->request->adapter == 'phpbb') {
             if (Session::read('non_linked_phpbb_login')) {
                 Session::delete('non_linked_phpbb_login');
                 $addendum = 'You are logged into the forums, but there is no leagues account associated with with your forum account.';
             } else {
                 $addendum = 'Please ensure that you are logged into the <a href="http://www.afdc.com/forum/">forums</a>.';
             }
         } else {
             Logger::debug("Failed login for " . $this->request->data['email'] . " with password " . $this->request->data["password"]);
         }
         $error_message = 'Your login was unsuccessful. ';
         if (isset($addendum) and !empty($addendum)) {
             $error_message .= "<br />{$addendum}`<br />";
         }
         $error_message .= 'If you\'re having trouble, checkout the <a href="/help/login">login instructions</a>.';
         $this->flashMessage($error_message, array('alertType' => 'error'));
     }
     return $this->redirect($redirectUrl);
 }
开发者ID:aniston,项目名称:Platypus,代码行数:44,代码来源:AuthController.php

示例7: delete

 public function delete()
 {
     Session::delete('user');
     return $this->redirect('/login');
 }
开发者ID:guoyu07,项目名称:admin-biarq-com,代码行数:5,代码来源:SessionsController.php

示例8: tearDown

	public function tearDown() {
		Session::delete('FlashMessage');
	}
开发者ID:nateabele,项目名称:Minerva-Plugin,代码行数:3,代码来源:FlashMessageTest.php

示例9: login

 /**
  * Provides a login page for users to login.
  *
  * @return type
  */
 public function login()
 {
     $user = Auth::check('li3b_user', $this->request);
     // 'triedAuthRedirect' so we don't end up in a redirect loop
     if (!Session::check('triedAuthRedirect', array('name' => 'cookie'))) {
         Session::write('triedAuthRedirect', 'false', array('name' => 'cookie', 'expires' => '+1 hour'));
     }
     // Facebook returns a session querystring... We don't want to show this to the user.
     // Just redirect back so it ditches the querystring. If the user is logged in, then
     // it will redirect like expected using the $url variable that has been set below.
     // Not sure why we need to do this, I'd figured $user would be set...And I think there's
     // a session just fine if there was no redirect and the user navigated away...
     // But for some reason it doesn't see $user and get to the redirect() part...
     if (isset($_GET['session'])) {
         $this->redirect(array('library' => 'li3b_users', 'controller' => 'users', 'action' => 'login'));
     }
     if ($user) {
         // Users will be redirected after logging in, but where to?
         $url = '/';
         // Default redirects for certain user roles
         switch ($user['role']) {
             case 'administrator':
             case 'content_editor':
                 $url = '/admin';
                 break;
             default:
                 $url = '/';
                 break;
         }
         // Second, look to see if a cookie was set. The could have ended up at the login page
         // because he/she tried to go to a restricted area. That URL was noted in a cookie.
         if (Session::check('beforeAuthURL', array('name' => 'cookie'))) {
             $url = Session::read('beforeAuthURL', array('name' => 'cookie'));
             // 'triedAuthRedirect' so we don't end up in a redirect loop
             $triedAuthRedirect = Session::read('triedAuthRedirect', array('name' => 'cookie'));
             if ($triedAuthRedirect == 'true') {
                 $url = '/';
                 Session::delete('triedAuthRedirect', array('name' => 'cookie'));
             } else {
                 Session::write('triedAuthRedirect', 'true', array('name' => 'cookie', 'expires' => '+1 hour'));
             }
             Session::delete('beforeAuthURL', array('name' => 'cookie'));
         }
         // Save last login IP and time
         $user_document = User::find('first', array('conditions' => array('_id' => $user['_id'])));
         if ($user_document) {
             $user_document->save(array('lastLoginIp' => $_SERVER['REMOTE_ADDR'], 'lastLoginTime' => new MongoDate()));
         }
         // only set a flash message if this is a login. it could be a redirect from somewhere else that has restricted access
         // $flash_message = FlashMessage::read('default');
         // if(!isset($flash_message['message']) || empty($flash_message['message'])) {
         FlashMessage::write('You\'ve successfully logged in.', 'default');
         // }
         $this->redirect($url);
     } else {
         if ($this->request->data) {
             FlashMessage::write('You entered an incorrect username and/or password.', 'default');
         }
     }
     $data = $this->request->data;
     return compact('data');
 }
开发者ID:tmaiaroto,项目名称:li3b_users,代码行数:67,代码来源:UsersController.php

示例10: logout

 public function logout($provider = 'apontador')
 {
     if ($provider == 'foursquare') {
         Session::delete('foursquareToken');
         Session::delete('foursquareName');
         Session::delete('foursquarePhoto');
         Session::delete('foursquareEmail');
     } elseif ($provider == 'twitter') {
         Session::delete('twitterUserId');
         Session::delete('twitterScreenName');
         Session::delete('twitterToken');
         Session::delete('twitterTokenSecret');
     } elseif ($provider == 'facebook') {
         Session::delete('facebookToken');
         Session::delete('facebookId');
         Session::delete('facebookName');
     } elseif ($provider == 'orkut') {
         Session::delete('orkutUserId');
         Session::delete('orkutScreenName');
         Session::delete('orkutToken');
         Session::delete('orkutTokenSecret');
     } elseif ($provider == 'apontador') {
         Session::delete('apontadorToken');
         Session::delete('apontadorTokenSecret');
         Session::delete('apontadorId');
         Session::delete('apontadorName');
     }
     $this->redirect('/settings');
 }
开发者ID:EHER,项目名称:chegamos,代码行数:29,代码来源:OauthController.php

示例11: testStrategiesPhpAdapter

 public function testStrategiesPhpAdapter()
 {
     Session::config(array('strategy' => array('adapter' => 'Php', 'strategies' => array('Hmac' => array('secret' => 'somesecretkey')))));
     $key = 'test';
     $value = 'value';
     Session::write($key, $value, array('name' => 'strategy'));
     $result = Session::read($key, array('name' => 'strategy'));
     $this->assertEqual($value, $result);
     $this->assertTrue(Session::delete($key, array('name' => 'strategy')));
     $result = Session::read($key, array('name' => 'strategy'));
     $this->assertNull($result);
     Session::write($key, $value, array('name' => 'strategy'));
     $result = Session::read($key, array('name' => 'strategy'));
     $this->assertEqual($value, $result);
     $cache = $_SESSION;
     $_SESSION['injectedkey'] = 'hax0r';
     $this->expectException('/Possible data tampering - HMAC signature does not match data./');
     $result = Session::read($key, array('name' => 'strategy'));
     $_SESSION = $cache;
 }
开发者ID:EHER,项目名称:chegamos,代码行数:20,代码来源:SessionTest.php

示例12: tearDown

 public function tearDown()
 {
     Session::delete('default');
     FlashMessage::reset();
 }
开发者ID:atelierdisko,项目名称:li3_flash_message,代码行数:5,代码来源:FlashMessageTest.php

示例13: tearDown

 public function tearDown()
 {
     Session::delete('default');
 }
开发者ID:gavd,项目名称:li3_flash_message,代码行数:4,代码来源:FlashMessageTest.php

示例14: testEncryptStrategyWithPhpAdapter

 public function testEncryptStrategyWithPhpAdapter()
 {
     $this->skipIf(PHP_SAPI === 'cli', 'No PHP session support in cli SAPI.');
     $this->skipIf(!extension_loaded('mcrypt'), 'The `mcrypt` extension is not loaded.');
     $config = array('name' => 'encryptInt');
     Session::config(array($config['name'] => array('adapter' => 'Php', 'strategies' => array('Encrypt' => array('secret' => 's3cr3t')))));
     Session::clear($config);
     $key = 'test';
     $value = 'value';
     $this->assertTrue(Session::write($key, $value, $config));
     $this->assertEqual($value, Session::read($key, $config));
     $this->assertTrue(Session::delete($key, $config));
     $this->assertNull(Session::read($key, $config));
     Session::clear($config);
     $this->assertTrue(Session::write('foo', 'bar', $config));
     $this->assertEqual('bar', Session::read('foo', $config));
     $this->assertTrue(Session::write('foo', 'bar1', $config));
     $this->assertEqual('bar1', Session::read('foo', $config));
     Session::clear($config);
     $this->assertTrue(Session::write($key, $value, $config));
     $this->assertEqual($value, Session::read($key, $config));
 }
开发者ID:fedeisas,项目名称:lithium,代码行数:22,代码来源:SessionTest.php

示例15: delete

 public function delete()
 {
     Auth::clear('member');
     Session::delete('default');
     return $this->redirect('/');
     exit;
 }
开发者ID:nilamdoc,项目名称:OxOPDF,代码行数:7,代码来源:SessionsController.php


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