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


PHP Session::getId方法代码示例

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


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

示例1: login

 /**
  * Override login method
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response
  */
 public function login(Request $request)
 {
     $this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required']);
     // If the class is using the ThrottlesLogins trait, we can automatically throttle
     // the login attempts for this application. We'll key this by the username and
     // the IP address of the client making these requests into this application.
     $throttles = $this->isUsingThrottlesLoginsTrait();
     if ($throttles && $this->hasTooManyLoginAttempts($request)) {
         return $this->sendLockoutResponse($request);
     }
     $credentials = $this->getCredentials($request);
     if (Auth::guard($this->getGuard())->attempt($credentials, $request->has('remember'))) {
         //Find same user in db, kill the previous session and save current session id
         $user = User::where('email', $request->get('email'))->first();
         if (!is_null($user->session_id)) {
             Session::getHandler()->destroy($user->session_id);
         }
         $user->session_id = Session::getId();
         $user->save();
         return $this->handleUserWasAuthenticated($request, $throttles);
     }
     // If the login attempt was unsuccessful we will increment the number of attempts
     // to login and redirect the user back to the login form. Of course, when this
     // user surpasses their maximum number of attempts they will get locked out.
     if ($throttles) {
         $this->incrementLoginAttempts($request);
     }
     return $this->sendFailedLoginResponse($request);
 }
开发者ID:lingboguo,项目名称:Laravel5Login,代码行数:34,代码来源:AuthController.php

示例2: authenticated

 protected function authenticated(Request $request, User $user)
 {
     $previousSessionID = $user->session;
     if (!$previousSessionID) {
         Session::getHandler()->destroy($previousSessionID);
     }
     $this->guard()->user()->session = Session::getId();
     $this->guard()->user()->save();
     return redirect()->intended($this->redirectPath());
 }
开发者ID:sthWrong,项目名称:season5.co,代码行数:10,代码来源:LoginController.php

示例3: handle

 /**
  * Execute creating a new batch.
  *
  * @return bool|Batch
  */
 public function handle()
 {
     $batch = new Batch();
     $batch->locked = false;
     $batch->session_id = Session::getId();
     $batch->uuid = uuid();
     $batch->lifetime = $this->lifetime;
     $batch->description = $this->description;
     $batch->name = $this->name;
     if ($batch->save()) {
         return $batch;
     }
     return false;
 }
开发者ID:stevebauman,项目名称:quickly-share-it,代码行数:19,代码来源:CreateBatch.php

示例4: getUserBySessionToken

 /**
  * @return User|array|null
  */
 public function getUserBySessionToken()
 {
     if (Auth::check()) {
         $header = apache_request_headers();
         $session_token_from_parse = $header['X-Parse-Session-Token'];
         $laravel_session_id = Session::getId();
         if ($laravel_session_id == $session_token_from_parse) {
             $result_array = Auth::user();
             $result_array['sessionToken'] = Session::getId();
             return $result_array;
         } else {
             $this->logout();
             return ParseHelperClass::error_message_return(209, ", user are logged out");
         }
     }
     return ParseHelperClass::error_message_return(209);
 }
开发者ID:malimu,项目名称:baas,代码行数:20,代码来源:UserController.php

示例5: logout

 /**
  * Log the user out of the application.
  *
  * @return void
  */
 public function logout()
 {
     $user = $this->user();
     // If we have an event dispatcher instance, we can fire off the logout event
     // so any further processing can be done. This allows the developer to be
     // listening for anytime a user signs out of this application manually.
     $this->clearUserDataFromStorage();
     MemberToken::where(['sessionId' => Session::getId()])->delete();
     if (isset($this->events)) {
         $this->events->fire('auth.logout', [$user]);
     }
     // Once we have fired the logout event we will clear the users out of memory
     // so they are no longer available as the user is no longer considered as
     // being signed into this application and should not be available here.
     $this->user = null;
     $this->loggedOut = true;
 }
开发者ID:bashmach,项目名称:ggf,代码行数:22,代码来源:Guard.php

示例6: ResetPassworduser

 public function ResetPassworduser(Request $request)
 {
     $netasset = DB::table('TBL_USER')->Where('EMP_ID', '=', get_userID())->first();
     $agent = new MeaAgent();
     $data = array("session_id" => Session::getId(), "username" => $netasset->USERNAME, "old_password" => $request->input('old_password'), "new_password" => $request->input('new_password'));
     //        var_dump($data);
     $curl = new Curl('CHANGE_PASS', $data);
     $result_login = $curl->getResult();
     if ($result_login->errCode != 0) {
         // login fail
         return redirect()->to('editprofile')->withErrors(['ไม่พบชื่อ login นี้', 'The email or password you entered is incorrect.']);
     } else {
         // logged in
         //            session(['logged_in' => true, 'user_data' => $result_login->result[0], 'access_channel' => 'frontend']);
         Logprocess(7, $data);
         return redirect()->to('editprofile')->with('message', 'ท่านได้เปลี่ยนรหัสผ่านเรียบร้อยแล้ว');
     }
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:18,代码来源:editprofileController.php

示例7: update

 public function update(Request $request, $id)
 {
     $session_id = Session::getId();
     if (!$session_id) {
         return response('', 400);
     }
     $this->validate($request, ['id' => 'required|integer']);
     $bookmark = Bookmark::find($id);
     if ($request->bookmark) {
         $bookmark->bookmark = $request->bookmark;
         $bookmark->save();
     }
     if ($request->bookmarked_at) {
         $bookmarked_at = new Carbon($request->bookmarked_at, auth()->user()->timezone);
         $bookmarked_at->setTimezone('UTC');
         $bookmark->bookmarked_at = $bookmarked_at->toDateTimeString();
         $bookmark->save();
     }
     return response('', 204);
 }
开发者ID:gitstashgithub,项目名称:rating,代码行数:20,代码来源:BookmarkController.php

示例8: checkLogin

 public function checkLogin(Request $request)
 {
     $agent = new MeaAgent();
     $data = array("session_id" => Session::getId(), "username" => $request->input('username'), "pwd" => $request->input('password'), "os" => $agent->platform(), "browser" => $agent->browser(), "ip_address" => $request->ip(), "access_channel" => $agent->access_channel(), "device_id" => "", "device_os" => $agent->platform());
     $curl = new Curl('Login', $data);
     $result_login = $curl->getResult();
     $retError = "";
     if ($result_login->errCode != 0) {
         switch ($result_login->errCode) {
             case 1:
                 $retError = "ท่านระบุรหัสผู้ใช้งานไม่ถูกต้อง";
                 break;
             case 2:
                 $retError = "ท่านระบุรหัสผ่านไม่ถูกต้อง";
                 break;
             case 7706:
                 $retError = "รหัสผู้ใช้งานของท่านไม่ได้รับอนุญาตให้เข้าใช้งานระบบ กรุณาติดต่อผู้ดูแลระบบ";
                 break;
             case 7707:
                 $retError = "ท่านไม่สามารถเข้าใช้งานระบบได้ เนื่องจากท่านได้ลาออกจากสมาชิกกองทุน เมื่อวันที่ " . get_date_notime($result_login->leave_fund_group_date) . " หากต้องการรายละเอียดเพิ่มเติม กรุณาติดต่อกองทุนสำรองเลี้ยงชีพ";
                 break;
             default:
                 $retError = 'The email or password you entered is incorrect.';
                 break;
         }
         // login fail
         return redirect()->to('login')->withErrors([$retError]);
     } else {
         if ($result_login->result[0]->first_login_flag == "0") {
             //echo "asdasd" . $result_login->result[0]->first_login_flag;
             //                session(['first_emp_id' => $filter1]);
             return redirect()->to('firstlogin')->with('emp_id', $result_login->result[0]->emp_id);
         } else {
             // logged in
             session(['logged_in' => true, 'user_data' => $result_login->result[0], 'access_channel' => 'frontend']);
             // echo  "hello";
             return redirect()->intended('/profile');
         }
     }
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:40,代码来源:AuthController.php

示例9: scopeUpdateCurrent

 /**
  * Updates the session of the current user.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $query
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function scopeUpdateCurrent(Builder $query)
 {
     $user = Sentinel::check();
     return $query->where('id', Session::getId())->update(['user_id' => $user ? $user->id : null]);
 }
开发者ID:umahatokula,项目名称:academia,代码行数:11,代码来源:Session.php

示例10: session_id

 public function session_id()
 {
     return Session::getId();
 }
开发者ID:kamilmiesiac,项目名称:microweber,代码行数:4,代码来源:UserManager.php

示例11: ReqPassword

 public function ReqPassword(Request $request)
 {
     $data = array("session_id" => Session::getId(), "username" => $request->input('username'));
     $curl = new Curl('REQUEST_NEW_PASS', $data);
     $result_login = $curl->getResult();
     //        var_dump($result_login);
     $staturet = false;
     $message = "";
     if ($result_login->errCode != 0) {
         $message = "ไม่พบผู้ใช้นี้";
     } else {
         $message = "ระบบได้ส่ง password ใหม่ไปทางอีเมล์ ของผู้ใช้นี้เรียบร้อยแล้ว";
         $staturet = true;
     }
     return response()->json(array('success' => $staturet, 'html' => $message));
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:16,代码来源:UserController.php

示例12: scopeLogoutCurrent

 /**
  * Updates the session of the current user.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $query
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function scopeLogoutCurrent(Builder $query)
 {
     return $query->where('id', SessionFacade::getId())->update(['user_id' => null]);
 }
开发者ID:NuestraMarca,项目名称:tenderos,代码行数:10,代码来源:Session.php

示例13: __construct

 public function __construct()
 {
     $this->sessionId = Session::getId();
     $this->adminUser = Auth::admin()->get();
 }
开发者ID:hlacos,项目名称:lara-mvcms,代码行数:5,代码来源:ApplicationLayoutComposer.php

示例14: create

 /**
  * Create a new session.
  *
  * @param string $ownerType Session owner's type (user, client)
  * @param string $ownerId Session owner's ID
  * @param string $clientId Client ID
  * @param string $clientRedirectUri Client redirect URI (default = null)
  *
  * @return int The session's ID
  */
 public function create($ownerType, $ownerId, $clientId, $clientRedirectUri = null)
 {
     return $this->getConnection()->table('oauth_sessions')->insertGetId(['client_id' => $clientId, 'owner_type' => $ownerType, 'owner_id' => $ownerId, 'session_key' => Session::getId(), 'client_redirect_uri' => $clientRedirectUri, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]);
 }
开发者ID:razor9999,项目名称:oauth2-server-laravel,代码行数:14,代码来源:FluentSession.php

示例15: get_key_prefix

 /**
  * Determine the unique prefix for the key by name.
  *
  * @param $name
  *
  * @return string
  * @throws \Seat\Services\Exceptions\SettingException
  */
 public static function get_key_prefix($name)
 {
     // Ensure we have a prefix to work with.
     if (is_null(static::$prefix)) {
         throw new SettingException('No prefix defined. Have you extended and declared $prefix?');
     }
     return implode('.', [Session::getId(), static::$prefix, $name]);
 }
开发者ID:warlof,项目名称:services,代码行数:16,代码来源:Settings.php


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