本文整理汇总了PHP中session类的典型用法代码示例。如果您正苦于以下问题:PHP session类的具体用法?PHP session怎么用?PHP session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了session类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: init
/**
* @TODO - there has to be a less heavy way of doing this...
*/
public function init($username = null)
{
global $db, $cache, $plugins;
global $groupscache, $forum_cache, $fpermcache, $mybb, $cached_forum_permissions_permissions, $cached_forum_permissions;
if (!defined('IN_MYBB')) {
define('IN_MYBB', true);
}
@(include_once dirname(DOCROOT) . '/mies/inc/init.php');
@(include_once MYBB_ROOT . 'inc/class_session.php');
try {
ob_start();
if (isset($mybb)) {
$session = new \session();
$session->init();
$mybb->session =& $session;
$this->myBB = $mybb;
} else {
$this->myBB = new \stdClass();
$this->myBB->user = ['username' => null];
if ($this->app['config']['mybb']['allowRandom']) {
$this->myBB->user['username'] = $username;
}
}
ob_end_clean();
} catch (\Exception $e) {
throw new AuthenticationException('Could not initialize MYBB application for authentication.');
}
}
开发者ID:Gipetto,项目名称:Chatfort54,代码行数:31,代码来源:MyBBUserProvider.php
示例2: oauth_callback
function oauth_callback($config)
{
$aConfig = array('appid' => $config['appid'], 'appkey' => $config['appkey'], 'api' => 'get_user_info,add_topic,add_one_blog,add_album,upload_pic,list_album,add_share,check_page_fans,add_t,add_pic_t,del_t,get_repost_list,get_info,get_other_info,get_fanslist,get_idollist,add_idol,del_idol,get_tenpay_addr');
$sUrl = "https://graph.qq.com/oauth2.0/token";
$aGetParam = array("grant_type" => "authorization_code", "client_id" => $aConfig["appid"], "client_secret" => $aConfig["appkey"], "code" => $_GET["code"], "state" => $_GET["state"], "redirect_uri" => $_SESSION["URI"]);
unset($_SESSION["state"]);
unset($_SESSION["URI"]);
$sContent = get($sUrl, $aGetParam);
if ($sContent !== FALSE) {
$aTemp = explode("&", $sContent);
$aParam = $oauth_data = array();
foreach ($aTemp as $val) {
$aTemp2 = explode("=", $val);
$aParam[$aTemp2[0]] = $aTemp2[1];
}
$oauth_data["access_token"] = $aParam["access_token"];
$sUrl = "https://graph.qq.com/oauth2.0/me";
$aGetParam = array("access_token" => $aParam["access_token"]);
$sContent = get($sUrl, $aGetParam);
if ($sContent !== FALSE) {
$aTemp = array();
preg_match('/callback\\(\\s+(.*?)\\s+\\)/i', $sContent, $aTemp);
$aResult = json_decode($aTemp[1], true);
$session = new session();
$oauth_data['oauth_openid'] = $aResult["openid"];
$session->set('oauth_data', $oauth_data);
}
}
}
开发者ID:rainbow88,项目名称:hummel,代码行数:29,代码来源:qq.php
示例3: save_meta_boxes
/**
* Saves the metaboxes
* @global type $post_type
* @param type $post_id
* @return boolean
*/
public function save_meta_boxes($post_id)
{
global $post_type;
$session = new session();
if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) {
return false;
}
if ($post_type !== 'syn_rest_meal') {
return false;
}
$full_price = $session->post_var('full_price');
$small_plate_price = $session->post_var('small_plate_price');
$display_price = $session->post_var('display_price', 'off');
$calorie_count = $session->post_var('calorie_count');
$new_addition = $session->post_var('new_addition');
$healthy_option = $session->post_var('healthy_option');
$gluten_free = $session->post_var('gluten_free');
$spice_rating = $session->post_var('spice_rating');
update_post_meta($post_id, 'full_price', $full_price);
update_post_meta($post_id, 'small_plate_price', $small_plate_price);
update_post_meta($post_id, 'display_price', $display_price);
update_post_meta($post_id, 'calorie_count', $calorie_count);
update_post_meta($post_id, 'new_addition', $new_addition);
update_post_meta($post_id, 'healthy_option', $healthy_option);
update_post_meta($post_id, 'gluten_free', $gluten_free);
update_post_meta($post_id, 'spice_rating', $spice_rating);
}
开发者ID:dridri51,项目名称:wordpress_workflow,代码行数:33,代码来源:class-meal-post-meta-boxes.php
示例4: validaLogin
function validaLogin()
{
$email = $_POST['email'];
$senha = $_POST['senha'];
echo '1';
if (!isset($email) || !isset($senha)) {
sessao_limpa();
}
echo '2';
if (strlen(trim($email)) == 0 || strlen(trim($senha) == 0)) {
header("Location: /login/error/msg/u_s");
}
echo '3';
$model = new model();
$query = "SELECT * FROM usuario WHERE email_usuario = '{$email}' AND senha_usuario = '{$senha}'";
$result = $model->readSQL($query);
$session = new session();
if ($result) {
$session->sessao_grava($result[0]['email_usuario'], $result[0]['id_usuario_tipo']);
header("Location: /index");
} else {
$session->sessao_limpa();
header("Location: /login/error/msg/u_s");
}
}
开发者ID:ErickMaeda,项目名称:controle-eventos-php-cow_tipping_dwarfs,代码行数:25,代码来源:loginController.php
示例5: testsession2
public function testsession2()
{
$v = JSFW()->getVersion();
jiashu::loadLib('session');
$sess = new session();
JSFW()->setTplData('n', $sess->sessionStart()->getSession('testsession'))->setTplData('v', $v);
JSFW()->render('index');
}
开发者ID:gusen,项目名称:jiashu,代码行数:8,代码来源:index.php
示例6: logout
function logout()
{
global $CONF, $LNG, $TMPL;
require_once "{$CONF['path']}/sources/misc/session.php";
$session = new session();
$session->delete($_COOKIE['atsphp_sid_user_cp']);
$TMPL['content'] = $LNG['user_cp_logout_message'];
}
开发者ID:BackupTheBerlios,项目名称:atsphp-svn,代码行数:8,代码来源:user_cpl.php
示例7: disconnectAction
/**
* @Route("/secured/disconnect")
* @Template()
*/
public function disconnectAction()
{
//On initialise la variable error a nul pour ne pas avoir de message d'erreur
$session = new session();
$session->invalidate();
return $this->redirect('/');
//On redirige vers l'accueil
}
开发者ID:qmigl,项目名称:rentmypet,代码行数:12,代码来源:SecuredController.php
示例8: index_action
public function index_action($pagina = 1)
{
$session = new session();
$session->sessao_valida();
$_SESSION['pagina'] = $pagina;
$this->smarty->assign('paginador', $this->mostraGrid());
$this->smarty->assign('title', 'Departamentos');
$this->smarty->display('departamento/index.tpl');
}
开发者ID:ErickMaeda,项目名称:controle-eventos-php-cow_tipping_dwarfs,代码行数:9,代码来源:departamentoController.php
示例9: checkSession
public function checkSession()
{
//Cette fonction sert à vérfier que l'utilisateur est connecté
$session = new session();
if ($session->isStarted()) {
return true;
} else {
return $this->render("loginBundle:default:login.html.twig", array('error' => "Veuillez vous connecter"));
}
}
开发者ID:qmigl,项目名称:rentmypet,代码行数:10,代码来源:DefaultController.php
示例10: checkLogin
function checkLogin()
{
$session = new session();
$login = $session->get("person_id");
if (isset($login)) {
return true;
} else {
return false;
}
}
开发者ID:xkeitax48,项目名称:mySamples,代码行数:10,代码来源:user.class.php
示例11: save_meta_boxes
public function save_meta_boxes($post_id)
{
global $post_type, $wpdb;
$session = new session();
if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) {
return false;
}
if ($post_type !== 'syn_rest_reservation') {
return false;
}
$first_name = $session->post_var('first_name');
$last_name = $session->post_var('last_name');
$phone_number = $session->post_var('phone_number');
$email_address = $session->post_var('email_address');
$guests_count = $session->post_var('guests_count');
$reservation_date = $session->post_var('reservation_date');
$reservation_time = $session->post_var('reservation_time');
update_post_meta($post_id, 'first_name', $first_name);
update_post_meta($post_id, 'last_name', $last_name);
update_post_meta($post_id, 'phone_number', $phone_number);
update_post_meta($post_id, 'email_address', $email_address);
update_post_meta($post_id, 'guests_count', $guests_count);
update_post_meta($post_id, 'reservation_date', $reservation_date);
update_post_meta($post_id, 'reservation_time', $reservation_time);
$arrival_time = date('Y-m-d H:i:s', strtotime("{$reservation_date}, {$reservation_time}"));
update_post_meta($post_id, 'arrival_time', $arrival_time);
$title = 'Reservation: ' . $first_name . ' ' . $last_name;
$where = array('ID' => $post_id);
$wpdb->update($wpdb->posts, array('post_title' => $title), $where);
}
开发者ID:dridri51,项目名称:wordpress_workflow,代码行数:30,代码来源:class-reservation-post-meta-boxes.php
示例12: get_current_user
private function get_current_user($sessID)
{
$sess = new session($sessID);
if ($sess->Started()) {
$person = new person();
$person->load_current_user($sess->Get("personID"));
// update session_started, which affects session lifetime
$sess->Save();
return $person;
}
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:11,代码来源:services.inc.php
示例13: index_action
public function index_action()
{
$session = new session();
$session->sessao_valida();
$modelEvento = new eventoModel();
$resEvento = $modelEvento->getEvento('stat<>0');
//send the records to template sytem
$this->smarty->assign('evento', $resEvento);
$this->smarty->assign('title', 'Emissão de Crachá');
$this->smarty->assign('listacliente', null);
//call the smarty
$this->smarty->display('cracha/index.tpl');
}
开发者ID:ErickMaeda,项目名称:controle-eventos-php-cow_tipping_dwarfs,代码行数:13,代码来源:crachaController.php
示例14: index_action
public function index_action($pagina = 1)
{
$session = new session();
$session->sessao_valida();
$_SESSION['pagina'] = $pagina;
//list all records
$cidade_model = new cidadeModel();
//send the records to template sytem
$this->smarty->assign('title', 'Cidades');
$this->smarty->assign('paginador', $this->mostraGrid());
//call the smarty
$this->smarty->display('cidade/index.tpl');
}
开发者ID:ErickMaeda,项目名称:controle-eventos-php-cow_tipping_dwarfs,代码行数:13,代码来源:cidadeController.php
示例15: notify
/**
* Methode qui va notifier une action
* Arguments:
* + $id: l'id de mon objet
* + $message: le message de notre notification
* + $nature: product | cms | categorie
* + $criticity: success - danger - warning - info
* nature: 0 mon compte, 1 product , 2 categories, 3 cms, 4 fournisseurs
*/
public function notify($id, $message, $nature = 'product', $criticity = "success")
{
// 1. Nous récupérons dans une variable $tabsession
// le tableau de notifications par sa nature
// $this->session->get('nature') permet de récupérer une information par sa clef
// le 2eme argument a la fonction get() permet d'initialiser un tableau vide
// si ma clefs en session n'existe pas
$tabsession = $this->session->get($nature, array());
// 2. Nous stockons dans ce tableau
// la notification avec un message, avec une criticité et une date
$tabsession[$id] = array('message' => $message, 'criticity' => $criticity, 'date' => new \DateTime("now"));
// 3. nous enregistrons le tableau des notifications en session
$this->session->set($nature, $tabsession);
}
开发者ID:unpetitlu,项目名称:store,代码行数:23,代码来源:Notification.php
示例16: get_url
function get_url()
{
global $sess;
$sess or $sess = new session();
$url = "project/project.php?projectID=" . $this->get_id();
if ($sess->Started()) {
$url = $sess->url(SCRIPT_PATH . $url);
// This for urls that are emailed
} else {
static $prefix;
$prefix or $prefix = config::get_config_item("allocURL");
$url = $prefix . $url;
}
return $url;
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:15,代码来源:project.inc.php
示例17: reset
function reset()
{
$this->_items =& session :: get('session_cart_' . $this->_cart_id . '_items');
if(!is_array($this->_items))
$this->_items = array();
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:session_cart_handler.class.php
示例18: get_instance
public static function get_instance()
{
if (is_null(session::$instance)) {
session::$instance = new session();
}
return session::$instance;
}
开发者ID:RuschGaming,项目名称:twitch,代码行数:7,代码来源:session.php
示例19: new_password
function new_password()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
require_once "{$CONF['path']}/sources/misc/session.php";
$session = new session();
list($type, $data) = $session->get($FORM['sid']);
$TMPL['username'] = $DB->escape($data);
$password = md5($FORM['password']);
if ($type == 'lost_pw') {
$session->delete($FORM['sid']);
$DB->query("UPDATE {$CONF['sql_prefix']}_sites SET password = '{$password}' WHERE username = '{$TMPL['username']}'", __FILE__, __LINE__);
$TMPL['content'] = $this->do_skin('lost_pw_finish_2');
} else {
$this->error($LNG['g_session_expired']);
}
}
开发者ID:BackupTheBerlios,项目名称:atsphp-svn,代码行数:16,代码来源:lost_pw.php
示例20: addStepOne
public function addStepOne()
{
$data = array();
$data['boat_name'] = $_POST['headline'];
$data['boat_type'] = $_POST['boat_type'];
$data['construction_year'] = $_POST['year'];
$data['ce_category'] = $_POST['boat_category'];
$data['yard'] = $_POST['boat_yard'];
$data['boat_model'] = $_POST['boat_model'];
$data['latitude'] = $_POST['latitude'];
$data['longitude'] = $_POST['longitude'];
$data['length'] = $_POST['length'];
$data['width'] = $_POST['width'];
$data['clearance'] = $_POST['clearance'];
$data['draft'] = $_POST['draft'];
$data['weight'] = $_POST['weight'];
$data['passengers'] = $_POST['passengers'];
$data['cabins'] = $_POST['cabins'];
$data['berth'] = $_POST['berth'];
$data['deck_color'] = $_POST['deck_color'];
$data['hull_color'] = $_POST['hull_color'];
$data['deck_mat'] = $_POST['deck_mat'];
$data['hull_mat'] = $_POST['hull_mat'];
$data['type'] = $_POST['featured_status'];
$data['userid'] = session::get('userId');
// $data['title'] = $_POST['headline'];
// $data['city'] = $_POST['city'];
// $data['country'] = $_POST['country'];
// $data['telec'] = $_POST['telecomute'];
// $data['type'] = $_POST['featured_status'];
// $data['userid'] = session::get('userId');
return $this->model->addStepOne($data);
}
开发者ID:vistazp,项目名称:boatseller,代码行数:33,代码来源:postjob.php
注:本文中的session类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论