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


PHP session_set函数代码示例

本文整理汇总了PHP中session_set函数的典型用法代码示例。如果您正苦于以下问题:PHP session_set函数的具体用法?PHP session_set怎么用?PHP session_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: action_deplacer_saisie_dist

/**
 * Action de déplacement de saisies dans le constructeur de formulaires
 *
 * @return void
**/
function action_deplacer_saisie_dist()
{
    include_spip('inc/session');
    $session = _request('session');
    $identifiant = _request('saisie');
    $ou = _request('ou');
    // On récupère le formulaire à son état actuel
    $formulaire_actuel = session_get($session);
    if (!$formulaire_actuel) {
        return '';
    }
    include_spip('inc/saisies');
    $saisies_actuelles = saisies_lister_par_identifiant($formulaire_actuel);
    if (!isset($saisies_actuelles[$identifiant])) {
        return '';
    }
    // tester @id et [@id] (fieldset)
    if ($ou and !isset($saisies_actuelles[$ou]) and !isset($saisies_actuelles[substr($ou, 1, -1)])) {
        return '';
    }
    // on deplace ou c'est demande...
    $formulaire_actuel = saisies_deplacer($formulaire_actuel, $identifiant, $ou);
    // On sauve tout ca
    $formulaire_actuel = session_set($session, $formulaire_actuel);
}
开发者ID:RadioCanut,项目名称:site-radiocanut,代码行数:30,代码来源:deplacer_saisie.php

示例2: EditForm

 function EditForm()
 {
     parent::MailForm();
     global $cgi, $_helpdoc;
     $this->addWidget('hidden', 'appname');
     $this->addWidget('hidden', 'lang');
     $this->addWidget('hidden', 'helpfile');
     $w =& $this->addWidget('text', 'filename');
     $w->alt = intl_get('File Name (ie. 001-about-myApp)');
     $w->addRule('not empty', intl_get('You must specify a file name.'));
     $w->addRule('not contains ".."', intl_get('Your file name contains invalid characters.'));
     $w->setValue($cgi->helpfile);
     $w =& $this->addWidget('text', 'title');
     $w->alt = intl_get('Title');
     $w->addRule('not empty', intl_get('You must specify a title.'));
     $w->setValue($_helpdoc->title);
     session_set('imagechooser_path', 'inc/app/' . $cgi->appname . '/pix');
     $this->extra = 'onsubmit="xed_copy_value (this, \'body\')"';
     $w =& $this->addWidget('xed.Widget.Xeditor', 'body');
     $w->setValue($_helpdoc->body);
     $w =& $this->addWidget('msubmit', 'submit_button');
     $b =& $w->getButton();
     $b->setValues(intl_get('Save'));
     $b =& $w->addButton('submit_button');
     $b->setValues(intl_get('Cancel'));
     $b->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $cgi->appname . '&lang=' . $cgi->lang . '\'; return false"';
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:27,代码来源:index.php

示例3: SitetemplateNewtplForm

 function SitetemplateNewtplForm()
 {
     parent::MailForm();
     global $cgi;
     $this->parseSettings('inc/app/sitetemplate/forms/newtpl/settings.php');
     if (@file_exists('inc/app/xed/lib/Widget/Linker.php')) {
         $this->link_chooser = true;
     }
     $mode = 'html';
     $name = 'new file';
     $set = $cgi->set_name;
     $sname = $set;
     session_set('imagechooser_path', site_prefix() . '/inc/html/' . $set . '/pix');
     if (@file_exists('inc/html/' . $set . '/config.ini.php')) {
         $info = parse_ini_file('inc/html/' . $set . '/config.ini.php');
         if (isset($info['set_name'])) {
             $sname = $info['set_name'];
         }
     }
     page_title(intl_get('Editing New Template in') . ': ' . $sname);
     $set = str_replace('/' . $mode . '.' . $name . '.' . $ext, '', $cgi->path);
     //$this->widgets['edit_buttons']->data = array ('mode' => strtoupper ($mode), 'name' => ucfirst ($name), 'link_chooser' => $this->link_chooser);
     //$this->widgets['body']->setValue (join ('', file ('inc/html/' . $sname)));
     $this->widgets['submit_buttons']->data = array('set' => $set);
     $this->widgets['path']->setValue($set);
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:26,代码来源:index.php

示例4: session_test

function session_test()
{
    tem_load('code/wfpl/test/session_test.html');
    db_delete('wfpl_sessions');
    db_delete('wfpl_session_data');
    session_dump('Clean slate');
    session_new();
    session_dump('new session');
    session_set('username', 'jason');
    session_dump('username jason');
    session_set('username', 'phil');
    session_dump('overwrote username as phil');
    $old = $GLOBALS['session_id'];
    session_new();
    session_dump('new session');
    session_set('username', 'jason');
    session_set('bamph', 'foo');
    session_dump('set username=jason and bamph=foo in new session');
    session_clear('username');
    session_dump('cleared username in new session');
    _kill_session($old);
    session_dump('killed old session');
    kill_session();
    session_dump('kill_session()');
    tem_output();
}
开发者ID:JoshuaGrams,项目名称:wfpl,代码行数:26,代码来源:session_test.php

示例5: testSessions

 public function testSessions()
 {
     $expected = "Session var " . rand();
     session_set('my_sess_var', $expected);
     $session_var = session_get('my_sess_var');
     $this->assertEquals($session_var, $expected);
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:7,代码来源:SessionsTest.php

示例6: cvtautosave_formulaire_traiter

/**
 * Quand on poste definitivement un formulaire autosave,
 * on peut vider la session autosave
 * et on vide aussi toutes les autosave de plus de 72H (delai par defaut) ou sans __timestamp (vieilles sessions)
 * @param $flux
 * @return
 */
function cvtautosave_formulaire_traiter($flux)
{
    // si on poste 'autosave' c'est qu'on n'a plus besoin de sauvegarder :
    // on elimine les donnees de la session
    if ($cle_autosave = _request('autosave')) {
        include_spip('inc/session');
        session_set('session_autosave_' . $cle_autosave, null);
        // delai par defaut avant purge d'un backup de form : 72H
        if (!defined('_AUTOSAVE_GB_DELAY')) {
            define('_AUTOSAVE_GB_DELAY', 72 * 3600);
        }
        $time_too_old = time() - _AUTOSAVE_GB_DELAY;
        // purger aussi toutes les vieilles autosave
        $session = $GLOBALS['visiteur_session'];
        foreach ($session as $k => $v) {
            if (strncmp($k, 'session_autosave_', 17) == 0) {
                $timestamp = 0;
                if (preg_match(",&__timestamp=(\\d+)\$,", $v, $m)) {
                    $timestamp = intval($m[1]);
                }
                if ($timestamp < $time_too_old) {
                    session_set($k, null);
                }
            }
        }
    }
    return $flux;
}
开发者ID:loorenzooo,项目名称:aslfc,代码行数:35,代码来源:cvt_autosave.php

示例7: formulaires_ecrire_auteur_verifier_dist

function formulaires_ecrire_auteur_verifier_dist($id_auteur, $id_article, $mail)
{
    $erreurs = array();
    include_spip('inc/filtres');
    if (!($adres = _request('email_message_auteur'))) {
        $erreurs['email_message_auteur'] = _T("info_obligatoire");
    } elseif (!email_valide($adres)) {
        $erreurs['email_message_auteur'] = _T('form_prop_indiquer_email');
    } else {
        include_spip('inc/session');
        session_set('email', $adres);
    }
    if (!($sujet = _request('sujet_message_auteur'))) {
        $erreurs['sujet_message_auteur'] = _T("info_obligatoire");
    } elseif (!(strlen($sujet) > 3)) {
        $erreurs['sujet_message_auteur'] = _T('forum:forum_attention_trois_caracteres');
    }
    if (!($texte = _request('texte_message_auteur'))) {
        $erreurs['texte_message_auteur'] = _T("info_obligatoire");
    } elseif (!(strlen($texte) > 10)) {
        $erreurs['texte_message_auteur'] = _T('forum:forum_attention_dix_caracteres');
    }
    if (_request('nobot')) {
        $erreurs['message_erreur'] = _T('pass_rien_a_faire_ici');
    }
    if (!_request('confirmer') and !count($erreurs)) {
        $erreurs['previsu'] = ' ';
    }
    return $erreurs;
}
开发者ID:genma,项目名称:spip_ynh,代码行数:30,代码来源:ecrire_auteur.php

示例8: testSessionSetterGetter

 /**
  * Test cases for _g()
  */
 public function testSessionSetterGetter()
 {
     // 1.
     session_set('name.first', 'Sithu');
     session_set('name.last', 'Kyaw');
     $this->assertEqual(session_get('name'), array('first' => 'Sithu', 'last' => 'Kyaw'));
     // 2.
     session_set('name.first', 'Kyaw');
     $this->assertEqual(session_get('name'), array('first' => 'Kyaw', 'last' => 'Kyaw'));
     // 3.
     session_set('foo', 'bar');
     $this->assertEqual(session_get('foo'), 'bar');
     // 4.
     $animals = array('dog', 'cat', 'tiger');
     session_set('animals', $animals);
     $this->assertEqual(session_get('animals'), array('dog', 'cat', 'tiger'));
     // 5.
     session_set('user', array('fullName' => 'Sithu Kyaw', 'firstName' => 'Sithu', 'lastName' => 'Kyaw', 'age' => 31, 'phone' => array('123456', '987654'), 'address' => array('street' => array('no' => 1, 'room' => 2, 'street' => 'Main Street'), 'city' => 'Yangon', 'country' => 'Myanmar', 'zip' => '11001')));
     $this->assertEqual(session_get('user'), array('fullName' => 'Sithu Kyaw', 'firstName' => 'Sithu', 'lastName' => 'Kyaw', 'age' => 31, 'phone' => array('123456', '987654'), 'address' => array('street' => array('no' => 1, 'room' => 2, 'street' => 'Main Street'), 'city' => 'Yangon', 'country' => 'Myanmar', 'zip' => '11001')));
     // 6.
     session_set('user.phone', '123456');
     session_set('user.address.zip', '11111');
     $this->assertEqual(session_get('user'), array('fullName' => 'Sithu Kyaw', 'firstName' => 'Sithu', 'lastName' => 'Kyaw', 'age' => 31, 'phone' => '123456', 'address' => array('street' => array('no' => 1, 'room' => 2, 'street' => 'Main Street'), 'city' => 'Yangon', 'country' => 'Myanmar', 'zip' => '11111')));
     // 7.
     $auth = array('name' => 'tetete', 'email' => 'tetete@localhost.com');
     session_set('auth', $auth, true);
     $this->assertEqual(session_get('auth', true), $auth);
 }
开发者ID:phplucidframe,项目名称:phplucidframe,代码行数:31,代码来源:session_helper.test.php

示例9: SitetemplateEditForm

 function SitetemplateEditForm()
 {
     parent::MailForm();
     global $cgi;
     $this->parseSettings('inc/app/sitetemplate/forms/edit/settings.php');
     if (@file_exists('inc/app/xed/lib/Widget/Linker.php')) {
         $this->link_chooser = true;
     }
     list($set, $tpl) = explode('/', $cgi->path);
     list($mode, $name, $ext) = preg_split('|\\.|', basename($cgi->path));
     if (@file_exists('inc/html/' . $set . '/config.ini.php')) {
         $info = parse_ini_file('inc/html/' . $set . '/config.ini.php');
         if (isset($info['set_name'])) {
             $sname = $info['set_name'];
         } else {
             $sname = $set;
         }
     } else {
         $sname = $set;
     }
     session_set('imagechooser_path', site_prefix() . '/inc/html/' . $set . '/pix');
     page_title(intl_get('Editing Template') . ': ' . $sname . ' / ' . strtoupper($mode) . ' / ' . ucfirst($name));
     $set = str_replace('/' . $mode . '.' . $name . '.' . $ext, '', $cgi->path);
     $this->widgets['edit_buttons']->data = array('mode' => strtoupper($mode), 'name' => ucfirst($name), 'link_chooser' => $this->link_chooser);
     $this->widgets['body']->setValue(join('', file('inc/html/' . $cgi->path)));
     $this->widgets['submit_buttons']->data = array('set' => $set);
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:27,代码来源:index.php

示例10: onSubmit

 function onSubmit($vals)
 {
     global $cgi;
     if ($vals['submit_buttons'] == 'Cancel') {
         header('Location: ' . $vals['refer']);
         exit;
     }
     loader_import('cms.Versioning.Rex');
     $rex = new Rex('siteblog_post');
     $id = $cgi->_key;
     $subject = $vals['subject'];
     $author = $vals['author'];
     $status = $vals['status'];
     $category = $vals['category'];
     $created = $vals['created'];
     $body = $vals['body'];
     $data = array('subject' => $subject, 'author' => $author, 'status' => $status, 'category' => $category, 'created' => $created, 'body' => $body);
     if (!empty($id)) {
         if (!$data['created']) {
             unset($data['created']);
         }
         $method = $rex->determineAction($id);
         $rex->{$method}($id, $data);
     } else {
         if (!$data['created']) {
             $data['created'] = date('Y-m-d H:i:s');
         }
         $id = $rex->create($data);
     }
     session_set('sitellite_alert', intl_get('Your item has been saved.'));
     // view post
     if (!empty($vals['_return'])) {
         header('Location: ' . $vals['_return']);
     } else {
         header('Location: ' . site_prefix() . '/index/siteblog-post-action/id.' . $id . '/title.' . siteblog_filter_link_title($subject));
     }
     // ping blog directories via pingomatic.com
     $host = 'rpc.pingomatic.com';
     $path = '';
     $out = template_simple('ping.spt', $obj);
     $len = strlen($out);
     $req = 'POST /' . $path . " HTTP/1.0\r\n";
     $req .= 'User-Agent: Sitellite ' . SITELLITE_VERSION . "/SiteBlog\r\n";
     $req .= 'Host: ' . $host . "\r\n";
     $req .= "Content-Type: text/xml\r\n";
     $req .= 'Content-Length: ' . $len . "\r\n\r\n";
     $req .= $out . "\r\n";
     if ($ph = @fsockopen($host, 80)) {
         @fputs($ph, $req);
         //echo '<pre>';
         //echo htmlentities ($req);
         while (!@feof($ph)) {
             $res = @fgets($ph, 128);
             //echo htmlentities ($res);
         }
         @fclose($ph);
     }
     exit;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:59,代码来源:index.php

示例11: rb_inserer_transaction

/**
 * Crée une transaction
 *
 * @param  integer $id_reservation id_reservation
 * @return $id_transaction  Id de la transaction crée
 */
function rb_inserer_transaction($id_reservation)
{
    session_set('id_reservation', $id_reservation);
    //Pas propre, ne devrait pas être dans la session, à améliorer
    $inserer_transaction = charger_fonction("inserer_transaction", "bank");
    $donnees = unserialize(recuperer_fond('inclure/paiement_reservation', array('id_reservation' => $id_reservation, 'cacher_paiement_public' => TRUE)));
    $id_transaction = $inserer_transaction($donnees['montant'], $donnees['options']);
    return $id_transaction;
}
开发者ID:abelass,项目名称:reservations_bank,代码行数:15,代码来源:reservation_bank_fonctions.php

示例12: cms_alert

/**
 * Shows a notice (e.g., "Item deleted.") if one is set.
 */
function cms_alert()
{
    if (!cms_is_alert()) {
        return '';
    }
    $notice = session_get('sitellite_alert');
    session_set('sitellite_alert', null);
    return template_simple('alert.spt', array('msg' => $notice));
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:12,代码来源:Alert.php

示例13: onSubmit

 function onSubmit($vals)
 {
     session_set('xed_source_find', $vals['find']);
     session_set('xed_source_replace', $vals['replace']);
     $vals['find'] = str_replace(array('\\', '\''), array('\\\\', '\\\''), $vals['find']);
     $vals['replace'] = str_replace(array('\\', '\''), array('\\\\', '\\\''), $vals['replace']);
     echo template_simple('replace_return.spt', $vals);
     exit;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:9,代码来源:index.php

示例14: session_save_messages

function session_save_messages()
{
    if (!isset($GLOBALS['wfpl_messages'])) {
        return;
    }
    if (!is_array($GLOBALS['wfpl_messages'])) {
        return;
    }
    init_session();
    session_set('wfpl_messages', array_to_string($GLOBALS['wfpl_messages']));
}
开发者ID:JoshuaGrams,项目名称:wfpl,代码行数:11,代码来源:session_messages.php

示例15: onSubmit

 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $collection = $vals['collection'];
     unset($vals['collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $rex = new Rex($collection);
     //$vals['sitellite_owner'] = session_username ();
     //$vals['sitellite_team'] = session_team ();
     unset($vals['submit_button']);
     unset($vals['tab1']);
     unset($vals['tab2']);
     unset($vals['tab3']);
     unset($vals['tab-end']);
     unset($vals['header_properties']);
     unset($vals['header_contact']);
     unset($vals['header_loc']);
     if ($vals['contact_url'] == 'http://') {
         $vals['contact_url'] = '';
     }
     if ($vals['loc_map'] == 'http://') {
         $vals['loc_map'] = '';
     }
     $res = $rex->create($vals, $changelog);
     if (isset($vals[$rex->key])) {
         $key = $vals[$rex->key];
     } elseif (!is_bool($res)) {
         $key = $res;
     } else {
         $key = 'Unknown';
     }
     if (!$res) {
         if (!$return) {
             $return = site_prefix() . '/index/cms-browse-action?collection=siteevent_event';
         }
         echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return));
     } else {
         loader_import('cms.Workflow');
         echo Workflow::trigger('add', array('collection' => $collection, 'key' => $key, 'data' => $vals, 'changelog' => intl_get('Item added.'), 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been created.'));
         if ($return) {
             header('Location: ' . $return);
             exit;
         }
     }
     header('Location: ' . site_prefix() . '/index/siteevent-app/id.' . $res);
     exit;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:54,代码来源:index.php


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