本文整理汇总了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');
}
示例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
}
示例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;
}
示例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());
}
示例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');
}
示例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');
}
示例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);
}
示例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));
}
示例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();
}
示例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');
}
}
示例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');
}
示例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));
}
示例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');
}
示例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');
}
示例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();
}