本文整理汇总了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');
}
示例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);
}
示例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));
}
示例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');
}
示例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));
}
示例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);
}
示例7: delete
public function delete()
{
Session::delete('user');
return $this->redirect('/login');
}
示例8: tearDown
public function tearDown() {
Session::delete('FlashMessage');
}
示例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');
}
示例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');
}
示例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;
}
示例12: tearDown
public function tearDown()
{
Session::delete('default');
FlashMessage::reset();
}
示例13: tearDown
public function tearDown()
{
Session::delete('default');
}
示例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));
}
示例15: delete
public function delete()
{
Auth::clear('member');
Session::delete('default');
return $this->redirect('/');
exit;
}