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


PHP session::set方法代码示例

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


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

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

示例2: ogrencikyt

 public function ogrencikyt()
 {
     $form = $this->load->otherClasses('Form');
     $form->post('no')->isEmpty()->length(0, 4);
     $form->post('ad')->isEmpty();
     $form->post('soyad')->isEmpty()->length(0, 100);
     $form->post('sinif')->isEmpty();
     $form->post('bolum')->isEmpty();
     $form->post('email')->isMail();
     if ($form->submit()) {
         $data = array('num' => $form->values['no'], 'ad' => $form->values['ad'], 'soyad' => $form->values['soyad'], 'sinif' => $form->values['sinif'], 'sube' => $form->values['bolum'], 'email' => $form->values['email']);
         $i_m = $this->load->model("index_model");
         $result = $i_m->ogrenciEkle($data);
         if ($result) {
             $mesaj = "işlemi başarıyla gerçekleşti";
         } else {
             $mesaj = "işlemi sırasında hata gerçekleşti";
         }
         session::set("mesaj", $mesaj);
         $this->load->view("panel/header");
         $this->load->view("panel/left");
         $this->load->view("panel/mesaj");
         $this->load->view("panel/footer");
     } else {
         $data["formErrors"] = $form->errors;
         $this->load->view("panel/header");
         $this->load->view("panel/left");
         $this->load->view("okutman/ogrenci", $data);
         $this->load->view("panel/footer");
     }
 }
开发者ID:naimakin,项目名称:BitirmeProjesi,代码行数:31,代码来源:Admin.php

示例3: respond

    function respond() {
        
        ini_set("display_errors","On");
        $where = array('ologin_code'=>front::$get['ologin_code']);
        $ologins = ologin::getInstance()->getrows($where);
        $ologin = unserialize_config($ologins[0]['ologin_config']);

        //var_dump($ologin);
        
        $aliapy_config['partner'] = $ologin['alipaylogin_id'];
        $aliapy_config['key'] = $ologin['alipaylogin_key'];
        $aliapy_config['return_url'] = ologin::url(basename(__FILE__,'.php'));
        $aliapy_config['sign_type']    = 'MD5';
        $aliapy_config['input_charset']= 'utf-8';
        $aliapy_config['transport']    = 'http';
        $aliapy_config['cacert']    = getcwd().'/lib/plugins/alipayauth/cacert.pem';
        //var_dump($aliapy_config);
        unset($_GET['case']);unset($_GET['act']);unset($_GET['ologin_code']);unset($_GET['site']);
        require_once("alipayauth/alipay_notify.class.php");
        $alipayNotify = new AlipayNotify($aliapy_config);
        //var_dump($alipayNotify);
        $verify_result = $alipayNotify->verifyReturn();
        //var_dump($verify_result);
        if($verify_result) {//验证成功
            $user_id = front::$get['user_id'];
            $token = front::$get['token'];
            session::set('access_token',$token);
            session::set("openid",$user_id);
            return array('nickname'=>  front::get('real_name'));
        }
        else {
            echo "验证失败";exit;
        }
    }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:34,代码来源:alipaylogin.php

示例4: _set

 /**
  *	Сохранить данные
  * @access	public
  */
 public function _set()
 {
     $data = $this->prepare_set();
     if (!empty($data)) {
         session::set($data, NULL, $this->di->name);
     }
 }
开发者ID:rigidus,项目名称:SBIN-DIESEL,代码行数:11,代码来源:session.connector.php

示例5: run

 public function run()
 {
     // Читаем настройки по-умолчению
     $this->config_default();
     // Читаем настройки, зависящие от БД
     $this->config_db();
     // Запускаем вьюшку с настройками
     $this->config_view();
     // Производим постобработку настроек
     $this->config_finish();
     $active = $this->view->navigation()->find_active();
     if ($active) {
         session::set('IsAuthorized', true);
     }
     if ($this->view->user()->is_allowed_by_key('admin')) {
         session::set('IsAuthorizedAdmin', true);
     }
     session::set('PathRoot', PATH_ROOT);
     // Если у пользователя есть права для доступа в раздел - рендерим основную функцию генерации раздела
     // Иначе - на авторизацию
     if ($this->config->controller == 'cindex' && $this->config->action == 'index' && $this->view->user('id') || $this->config->controller == 'cnotify' && ($this->config->action == 'read' || $this->config->action == 'mark') || $this->config->controller == 'cuser' && ($this->config->action == 'login' || $this->config->action == 'logout') || $active) {
         $method = 'route_' . $this->config->type;
         if (method_exists($this, $method)) {
             $this->{$method}();
         }
     } else {
         session::remove('IsAuthorized');
         session::remove('IsAuthorizedAdmin');
         $this->config->request->current = array('controller' => 'cuser', 'action' => 'login');
     }
     // "Рендер" раздела. На деле - это заполнение контентных переменных в настройках админки из тех же самых настроек
     $this->render();
 }
开发者ID:s-kalaus,项目名称:ekernel,代码行数:33,代码来源:control.php

示例6: dologinAction

 public function dologinAction()
 {
     Db::connect();
     $bean = R::dispense('user');
     // the redbean model
     $required = ['Name' => 'name', 'Email' => 'email', 'User_Name' => ['rmnl', 'az_lower'], 'Password' => 'password_hash'];
     \RedBeanFVM\RedBeanFVM::registerAutoloader();
     // for future use
     $fvm = \RedBeanFVM\RedBeanFVM::getInstance();
     $fvm->generate_model($bean, $required);
     //the magic
     R::store($bean);
     $val = new validation();
     $val->addSource($_POST)->addRule('email', 'email', true, 1, 255, true)->addRule('password', 'string', true, 10, 150, false);
     $val->run();
     if (count($val->errors)) {
         Debug::r($val->errors);
         foreach ($val->errors as $error) {
             Notification::setMessage($error, Notification::TYPE_ERROR);
         }
         $this->redirect(Request::createUrl('login', 'login'));
     } else {
         Notification::setMessage("Welcome back !", Notification::TYPE_SUCCESS);
         Debug::r($val->sanitized);
         session::set('user', ['sanil']);
         $this->redirect(Request::createUrl('index', 'index'));
     }
 }
开发者ID:santonil2004,项目名称:ovc,代码行数:28,代码来源:loginController.php

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

示例8: init

 /**
  * Initializing i18n
  *
  * @param array $options
  */
 public static function init($options = [])
 {
     $i18n = application::get('flag.global.i18n') ?? [];
     $i18n = array_merge_hard($i18n, $options ?? []);
     // determine final language
     $languages = factory::model('numbers_backend_i18n_languages_model_languages')->get();
     $final_language = application::get('flag.global.__language_code') ?? session::get('numbers.entity.format.language_code') ?? $i18n['language_code'] ?? 'sys';
     if (empty($languages[$final_language])) {
         $final_language = 'sys';
         $i18n['rtl'] = 0;
     }
     // put settings into system
     if (!empty($languages[$final_language])) {
         foreach ($languages[$final_language] as $k => $v) {
             $k = str_replace('lc_language_', '', $k);
             if (in_array($k, ['code', 'inactive'])) {
                 continue;
             }
             if (empty($v)) {
                 continue;
             }
             $i18n[$k] = $v;
         }
     }
     $i18n['language_code'] = $final_language;
     self::$options = $i18n;
     session::set('numbers.entity.format.language_code', $final_language);
     application::set('flag.global.i18n', $i18n);
     self::$initialized = true;
     // initialize the module
     return factory::submodule('flag.global.i18n.submodule')->init($i18n);
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:37,代码来源:i18n.php

示例9: confirm

 public function confirm($action = '')
 {
     // Do we have necessary data?
     if (input::get('oauth_token') && input::get('oauth_verifier')) {
         // Get temporary access token
         $this->initialize(session::item('twitter', 'remote_connect', 'token'), session::item('twitter', 'remote_connect', 'secret'));
         $access = $this->twitter->getAccessToken(input::get('oauth_verifier'));
         // Do we have temporary token?
         if ($access) {
             // Get saved token
             $token = $this->getToken(0, $access['user_id']);
             // Do we have saved token or are we logging in?
             if ($token || $action == 'login' && $token) {
                 $this->users_model->login($token['user_id']);
                 router::redirect(session::item('slug') . '#home');
             } elseif (!$token || $action == 'signup') {
                 // Get user data
                 $this->initialize($access['oauth_token'], $access['oauth_token_secret']);
                 $user = $this->getUser($access['user_id']);
                 // Do we have user data?
                 if ($user && isset($user->id)) {
                     $connection = array('name' => 'twitter', 'twitter_id' => $user->id, 'token' => $access['oauth_token'], 'secret' => $access['oauth_token_secret']);
                     session::set(array('connection' => $connection), '', 'remote_connect');
                     $account = array('username' => isset($user->name) ? $user->name : '');
                     session::set(array('account' => $account), '', 'signup');
                     router::redirect('users/signup#account');
                 }
             }
         }
     }
     router::redirect('users/login');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:32,代码来源:twitter.php

示例10: setLogin

 public static function setLogin($token, $isadmin = false, $db)
 {
     $_auth['tw_token'] = $token;
     $twitter = new TwitterOAuth(tw_consumer_key, tw_consumer_secret, $token['oauth_token'], $token['oauth_token_secret']);
     $response = $twitter->get('account/verify_credentials');
     $user = array('id' => $response->id, 'name' => $response->name, 'screen_name' => $response->screen_name, 'location' => $response->location, 'time_zone' => $response->time_zone, 'verified' => $response->verified, 'profile_image_url' => $response->profile_image_url, 'lang' => $response->lang);
     $_auth['user'] = $user;
     $_auth['isadmin'] = $user['id'] === 83455478;
     // $_auth['twitter']=$twitter;
     $sth = $db->prepare('INSERT INTO login
   (
     twitter_id,
     twitter_name,
     twitter_screen_name,
     twitter_location,
     twitter_time_zone,
     twitter_lang
   )
     VALUES
     (
       :twitter_id,
       :twitter_name,
       :twitter_screen_name,
       :twitter_location,
       :twitter_time_zone,
       :twitter_lang
     )');
     $sth->execute(array(':twitter_id' => $user['id'], ':twitter_name' => $user['name'], ':twitter_screen_name' => $user['screen_name'], ':twitter_location' => $user['location'], ':twitter_time_zone' => $user['time_zone'], ':twitter_lang' => $user['lang']));
     $_auth['login_id'] = $db->lastInsertId();
     session::set('auth', $_auth);
 }
开发者ID:emreplt,项目名称:keepitter,代码行数:31,代码来源:auth.php

示例11: remotelogin_action

 function remotelogin_action() {
     cookie::del('passinfo');
     $this->view->loginfalse=cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI']));
     if (front::$args) {
         $user=new user();
         $args = xxtea_decrypt(base64_decode(front::$args), config::get('cookie_password'));
         $user=$user->getrow(unserialize($args));
         if (is_array($user)) {
             if ($user['groupid'] == '888')
                 front::$isadmin=true;
             cookie::set('login_username',$user['username']);
             cookie::set('login_password',front::cookie_encode($user['password']));
             session::set('username',$user['username']);
             require_once ROOT.'/celive/include/config.inc.php';
             require_once ROOT.'/celive/include/celive.class.php';
             $login=new celive();
             $login->auth();
             $GLOBALS['auth']->remotelogin($user['username'],$user['password']);
             $GLOBALS['auth']->check_login1();
             front::$user=$user;
         }elseif (!is_array(front::$user) ||!isset(front::$isadmin)) {
             cookie::set('loginfalse'.md5($_SERVER['REQUEST_URI']),(int) cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])) +1,time() +3600);
             event::log('loginfalse','失败 user='.$user['username']);
             front::flash('密码错误或不存在该管理员!');
             front::refresh(url('admin/login',true));
         }
     }
     $this->render();
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:29,代码来源:admin_act.php

示例12: CreateImage

 public function CreateImage()
 {
     $ini = microtime(true);
     /** Initialization */
     $this->ImageAllocate();
     /** Text insertion */
     $text = $this->GetCaptchaText();
     session::set($this->sessName, $text);
     $fontcfg = $this->fonts[array_rand($this->fonts)];
     $this->WriteText($text, $fontcfg);
     /** Transformations */
     $this->WaveImage();
     // 添加干扰
     for ($i = 0; $i < 30; $i++) {
         $rand_color = imagecolorallocate($this->im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagearc($this->im, mt_rand(0, 2 * $this->width), mt_rand(0, 2 * $this->height), mt_rand(30, $this->width * 2), mt_rand(20, $this->height * 2), mt_rand(0, 360), mt_rand(0, 360), $rand_color);
     }
     for ($i = 0; $i < 50; $i++) {
         $rand_color = imagecolorallocate($this->im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagesetpixel($this->im, mt_rand(0, $this->width), mt_rand(0, $this->height), $rand_color);
     }
     if ($this->blur && function_exists('imagefilter')) {
         imagefilter($this->im, IMG_FILTER_GAUSSIAN_BLUR);
     }
     $this->ReduceImage();
     if ($this->debug) {
         imagestring($this->im, 1, 1, $this->height - 8, "{$text} {$fontcfg['font']} " . round((microtime(true) - $ini) * 1000) . "ms", $this->GdFgColor);
     }
     /** Output */
     $this->WriteImage();
     $this->Cleanup();
 }
开发者ID:weipinglee,项目名称:nn2,代码行数:32,代码来源:captcha.php

示例13: save

 function save()
 {
     $request =& request::instance();
     $tab_id = session_history_manager::datermine_tab_id();
     if (!($history = session::get('session_history'))) {
         $history = array();
     }
     if (!isset($history[$tab_id])) {
         $history[$tab_id] = array();
     }
     $uri =& $request->get_uri();
     $uri->remove_query_item('rn');
     if ($uri->get_query_item('popup')) {
         return;
     }
     $object_data = fetch_requested_object();
     if ($object_data['class_name'] == 'control_panel') {
         return;
     }
     $history_item = array('title' => $object_data['title'], 'href' => $uri->to_string());
     $first = end($history[$tab_id]);
     if ($first) {
         $latest_uri =& new uri($first['href']);
         if ($uri->compare($latest_uri)) {
             return;
         }
     }
     if (count($history[$tab_id]) >= 10) {
         $history[$tab_id] = array_reverse($history[$tab_id]);
         array_pop($history[$tab_id]);
         $history[$tab_id] = array_reverse($history[$tab_id]);
     }
     array_push($history[$tab_id], $history_item);
     session::set('session_history', $history);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:35,代码来源:session_history_manager.class.php

示例14: link

 public function link($data)
 {
     $query = $this->db->prepare("SELECT * FROM logins Where usern = :login");
     $u = $data['username'];
     $query->bindParam(':login', $u);
     $query->execute();
     $results = $query->fetch(PDO::FETCH_ASSOC);
     try {
         if (!$results) {
             throw new Exception('No username found m8');
         }
         $p = hash::create('md5', $data['password'], HASH_KEY);
         if (!($results['passw'] === $p)) {
             throw new Exception('wrong password dumbass');
         }
         if ($results['Active'] == 0) {
             throw new Exception('Please activate your account');
         }
         session::set('loggedIn', true);
         session::set('role', $results['role']);
         session::set('userid', $results['u_id']);
         session::set('username', $results['usern']);
         if (isset($data['remember'])) {
             setcookie("user", $u, time() + 7200, "/");
         }
         session_regenerate_id();
         header('Location: ../dashboard/index');
         exit;
     } catch (Exception $e) {
         $_SESSION = array();
         $_SESSION['errors'] = $e->getMessage();
         header('Location: ../login');
     }
 }
开发者ID:anjuna,项目名称:nipple,代码行数:34,代码来源:login_model.php

示例15: setSession

 function setSession($result)
 {
     $session = new session();
     switch ($result) {
         case "empty":
             $session->set("error_message", "入力されていない項目があります");
             $session->set("posted_email", $this->email);
             break;
         case "failure":
             $session->set("error_message", "emailかpasswordが間違っています");
             $session->set("posted_email", $this->email);
             break;
         case "success":
             $session->set("person_id", $this->person_id);
             break;
     }
 }
开发者ID:xkeitax48,项目名称:mySamples,代码行数:17,代码来源:user.class.php


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