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


PHP Session::has方法代码示例

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


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

示例1: login

 private function login()
 {
     $session = new Session();
     if (!$session->has('documentsUser')) {
         $this->redirect('dokumenty-login.html', true);
     }
 }
开发者ID:posiadacz,项目名称:wsm,代码行数:7,代码来源:DocumentsController.php

示例2: validate

 function validate()
 {
     if (!Session::has('vatsimauth')) {
         throw new AuthException('Session does not exist');
     }
     $SSO = new SSO(Config::get('vatsim.base'), Config::get('vatsim.key'), Config::get('vatsim.secret'), Config::get('vatsim.method'), Config::get('vatsim.cert'));
     $session = Session::get('vatsimauth');
     if (Input::get('oauth_token') !== $session['key']) {
         throw new AuthException('Returned token does not match');
         return;
     }
     if (!Input::has('oauth_verifier')) {
         throw new AuthException('No verification code provided');
     }
     $user = $SSO->checkLogin($session['key'], $session['secret'], Input::get('oauth_verifier'));
     if ($user) {
         Session::forget('vatsimauth');
         $authUser = User::find($user->user->id);
         if (is_null($authUser)) {
             $authUser = new User();
             $authUser->vatsim_id = $user->user->id;
             $authUser->name = trim($user->user->name_first . ' ' . $user->user->name_last);
         }
         $authUser->last_login = Carbon::now();
         $authUser->save();
         Auth::login($authUser);
         Messages::success('Welcome on board, <strong>' . $authUser->name . '</strong>!');
         return Redirect::intended('/');
     } else {
         $error = $SSO->error();
         throw new AuthException($error['message']);
     }
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:33,代码来源:AuthController.php

示例3: post_login

 public function post_login()
 {
     $errors = new Laravel\Messages();
     $input = Input::get();
     try {
         $validator = new Services\Session\Login\Validator($input);
         $validator->publish();
     } catch (ValidateException $errors) {
         return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors->get());
     }
     try {
         $valid_login = Sentry::login(Input::get('email'), Input::get('password'), Input::get('remember-me'));
         if ($valid_login) {
             $url = null;
             if (Session::has('pre_login_url')) {
                 $url = Session::get('pre_login_url');
                 Session::forget('pre_login_url');
             } else {
                 $url = URL::to_route('dashboard.profile');
             }
             return Redirect::to($url);
         } else {
             $errors->add('errors', __('application.invalid_login'));
             return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors);
         }
     } catch (Sentry\SentryException $e) {
         $errors->add('errors', $e->getMessage());
         return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors);
     }
 }
开发者ID:jvillasante,项目名称:cubanartjb,代码行数:30,代码来源:session.php

示例4: getInstance

 /**
  * @return mixed|static
  */
 public static function getInstance()
 {
     if (!\Session::has('cart')) {
         return new static();
     }
     return \Session::get('cart');
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:10,代码来源:SessionDrivenCart.php

示例5: get

 public function get()
 {
     $user_id = false;
     if (Auth::check()) {
         // Authenticating A User And "Remembering" Them
         Session::regenerate();
         $user_id = Auth::user()->id;
         if (Auth::user()->accountType == 1) {
             if (Session::has('admin_session')) {
                 Log::info("admin_session already created before - " . Session::get('admin_session'));
             } else {
                 Session::put('admin_session', $user_id);
                 Log::info("admin_session created");
             }
         }
         //            Log::info("Session cre8 - " . Session::get('admin_session'));
     }
     //        else if (Auth::viaRemember()) {
     //            // Determining If User Authed Via Remember
     //            $user_id = Auth::user()->id;
     //        }
     if (!$user_id) {
         $error_response = array('error' => array('message' => 'User not logged in.', 'type' => 'OAuthException', 'code' => 400));
         Log::info("User not logged in");
         return Response::json($error_response, 400)->setCallback(Input::get('callback'));
     }
     $user = User::find(Auth::user()->id);
     return Response::json($user)->setCallback(Input::get('callback'));
 }
开发者ID:andrewchng,项目名称:cSystem,代码行数:29,代码来源:AuthController.php

示例6: testClearUserAddSelftProfile

 public function testClearUserAddSelftProfile()
 {
     \Session::put('Giftertipster\\Service\\Add\\AddProfileMgr.user_add_self_profile', 'test');
     assertThat(\Session::has('Giftertipster\\Service\\Add\\AddProfileMgr.user_add_self_profile'), identicalTo(true));
     $this->add_profile_mgr->clearUserAddSelfProfile();
     assertThat(\Session::has('Giftertipster\\Service\\Add\\AddProfileMgr.user_add_self_profile'), identicalTo(false));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:AddProfileMgrTest.php

示例7: islogin

 public function islogin()
 {
     if (!\Session::has('user.uid')) {
         echo "<script>alert('您还没有登录,请先登录!');window.location.href='/login';</script>";
         exit;
     }
 }
开发者ID:946493655,项目名称:culture,代码行数:7,代码来源:IdeaController.php

示例8: getModificar

 public function getModificar($id = null)
 {
     if (is_null($id) && !Session::has('solicitud')) {
         $data['nuevo'] = true;
     } else {
         $data['nuevo'] = false;
     }
     if (Session::has('solicitud') && is_null($id)) {
         $data['solicitud'] = new Solicitud(Session::get('solicitud'));
     } else {
         $data['solicitud'] = Solicitud::findOrFail($id);
     }
     if (!$data['solicitud']->puedeModificar()) {
         return Redirect::to('solicitudes')->with('error', 'Solo se pueden editar solicitudes en Elaboración');
     }
     $data['beneficiario'] = Persona::findOrFail($data['solicitud']->persona_beneficiario_id);
     $data['solicitante'] = Persona::findOrNew($data['solicitud']->persona_solicitante_id);
     $data['familiares'] = $data['beneficiario']->getFamiliares();
     $data['familiar'] = new Persona();
     $data['recaudo'] = new RecaudoSolicitud();
     $data['recaudos'] = $data['solicitud']->recaudosSolicitud;
     $data['presupuesto'] = new Presupuesto();
     $data['presupuestos'] = $data['solicitud']->presupuestos;
     $data['bitacora'] = new Bitacora();
     $data['bitacoras'] = $data['solicitud']->bitacoras;
     $data['parentesco'] = $data['beneficiario']->getParentesco($data['solicitante']->id);
     $data['foto'] = new FotoSolicitud();
     $data['fotos'] = $data['solicitud']->fotos;
     $data['beneficiario_kerux'] = new Oracle\Beneficiario();
     if (Request::ajax()) {
         return Response::json($data);
     }
     return View::make("solicitudes.plantilla", $data);
 }
开发者ID:richarrieta,项目名称:miequipo,代码行数:34,代码来源:PermisosController.php

示例9: upload

 /**
  * @param Request $request
  * @Post("/gallery/upload")
  * @Patch("/gallery/upload")
  */
 public function upload(Request $request)
 {
     if (!Session::has('gallery_hash')) {
         Session::put('gallery_hash', md5(time()));
     }
     return Response::json(['attachment' => ImageUploadFacade::attachmentUpload($request->file('upl'), new GalleryAttachment(), 'gallery', true)]);
 }
开发者ID:za-laravel,项目名称:laravel-gallery,代码行数:12,代码来源:AdminGalleryController.php

示例10: __construct

 function __construct()
 {
     parent::__construct();
     if (!Session::has('vendor_id')) {
         Redirect::to('/')->send();
     }
 }
开发者ID:vk011,项目名称:emazze-vendor,代码行数:7,代码来源:ProductController.php

示例11: __construct

 public function __construct()
 {
     $this->oauth = new OAuth(self::CONFIG_KEY, self::CONFIG_SECRET);
     $this->state = Session::has('Twitter_State') ? Session::get('Twitter_State') : self::STATE_NOTHING;
     $this->token = Session::has('Twitter_Token') ? Session::get('Twitter_Token') : '';
     $this->tokenSecret = Session::has('Twitter_TokenSecret') ? Session::get('Twitter_TokenSecret') : '';
     if (Request::hasQuery('oauth_token')) {
         $this->state = self::STATE_AUTH;
         $this->token = Request::getQuery('oauth_token');
     }
     if (empty($this->token)) {
         $this->state = self::STATE_NOTHING;
     }
     // $this->destroy();
     switch ($this->state) {
         case self::STATE_NOTHING:
             break;
         case self::STATE_AUTH:
             $this->connect();
             break;
         case self::STATE_CONNECTED:
             $this->oauth->setToken($this->token, $this->tokenSecret);
             $this->credentials();
             break;
     }
 }
开发者ID:joksnet,项目名称:php-old,代码行数:26,代码来源:Twitter.php

示例12: getLogin

 public function getLogin()
 {
     if (\Session::has('adminlogin')) {
         return redirect()->action('\\Pianke\\Http\\Controllers\\AdminHomeController@getIndex');
     }
     return view("admin.login");
 }
开发者ID:9618211,项目名称:php-laravel-rbac,代码行数:7,代码来源:AdminLoginController.php

示例13: publish

 public function publish()
 {
     $fb = new Facebook(['app_id' => Config::get('facebook.app_id'), 'app_secret' => Config::get('facebook.app_secret'), 'default_graph_version' => Config::get('facebook.default_graph_version'), 'persistent_data_handler' => Config::get('facebook.persistent_data_handler')]);
     $helper = $fb->getRedirectLoginHelper();
     if (Session::has('photo')) {
         if (Input::has('quePiensas')) {
             $data = ['message' => Input::get('quePiensas'), 'source' => $fb->fileToUpload(Session::get('photo'))];
             try {
                 // Returns a `Facebook\FacebookResponse` object
                 $response = $fb->post('/me/photos', $data, Session::get('fb_access_token'));
             } catch (Facebook\Exceptions\FacebookResponseException $e) {
                 echo 'Graph returned an error: ' . $e->getMessage();
                 exit;
             } catch (Facebook\Exceptions\FacebookSDKException $e) {
                 echo 'Facebook SDK returned an error: ' . $e->getMessage();
                 exit;
             }
             $graphNode = $response->getGraphNode();
             return Redirect::to('/')->with('mensaje', 'Publicado con exito!');
         } else {
             return Redirect::to('/')->with('mensaje', 'Sin mensaje no hay amor');
         }
     } else {
         return Redirect::to('/')->with('mensaje', 'Sin foto no hay amor');
     }
 }
开发者ID:EncomUnlimited,项目名称:IE6APPF,代码行数:26,代码来源:HomeController.php

示例14: is_verification_expired

 protected function is_verification_expired()
 {
     if (Session::has('verification') && Session::get('verification.expire') > time()) {
         return false;
     }
     return true;
 }
开发者ID:xssworm,项目名称:hospital-register-system,代码行数:7,代码来源:UserController.php

示例15: getLogin

 public function getLogin()
 {
     if (Session::has("logined")) {
         return Redirect::to('/');
     }
     return View::make('frontend.users.login');
 }
开发者ID:tieuquangmg,项目名称:demo-php,代码行数:7,代码来源:UserController.php


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