本文整理汇总了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);
}
}
示例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']);
}
}
示例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);
}
}
示例4: getInstance
/**
* @return mixed|static
*/
public static function getInstance()
{
if (!\Session::has('cart')) {
return new static();
}
return \Session::get('cart');
}
示例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'));
}
示例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));
}
示例7: islogin
public function islogin()
{
if (!\Session::has('user.uid')) {
echo "<script>alert('您还没有登录,请先登录!');window.location.href='/login';</script>";
exit;
}
}
示例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);
}
示例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)]);
}
示例10: __construct
function __construct()
{
parent::__construct();
if (!Session::has('vendor_id')) {
Redirect::to('/')->send();
}
}
示例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;
}
}
示例12: getLogin
public function getLogin()
{
if (\Session::has('adminlogin')) {
return redirect()->action('\\Pianke\\Http\\Controllers\\AdminHomeController@getIndex');
}
return view("admin.login");
}
示例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');
}
}
示例14: is_verification_expired
protected function is_verification_expired()
{
if (Session::has('verification') && Session::get('verification.expire') > time()) {
return false;
}
return true;
}
示例15: getLogin
public function getLogin()
{
if (Session::has("logined")) {
return Redirect::to('/');
}
return View::make('frontend.users.login');
}