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


PHP Session::put方法代码示例

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


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

示例1: poll

 public static function poll($polls)
 {
     $polls = json_decode($polls);
     $_results = array();
     if (is_array($polls) && count($polls) > 0) {
         foreach ($polls as $i => $_poll) {
             switch ($_poll->type) {
                 case "template":
                     $_results[$_poll->id] = array('type' => 'html', 'args' => Theme::make($_poll->func, array('value' => $_poll->value))->render());
                     break;
                 case "plugin":
                     if ($_poll->func) {
                         $_results[$_poll->id] = call_user_func($_poll->func, $_poll->value);
                     }
                     break;
                 case "check_logs":
                     $list = Dashboard::activity();
                     Session::put('usersonline_lastcheck', time());
                     $_results[$_poll->id] = array('type' => 'function', 'func' => 'fnUpdateGrowler', 'args' => $list);
                     break;
             }
         }
     }
     return $_results;
 }
开发者ID:Aranjedeath,项目名称:Laravel_Starter,代码行数:25,代码来源:Dashboard.php

示例2: dologin

    public function dologin()
    {
        $rules = array('username' => 'required', 'password' => 'required');
        $message = array('required' => 'Data :attribute harus diisi', 'min' => 'Data :attribute minimal diisi :min karakter');
        $validator = Validator::make(Input::all(), $rules, $message);
        if ($validator->fails()) {
            return Redirect::to('/')->withErrors($validator)->withInput(Input::except('password'));
        } else {
            $data = array('username' => Input::get('username'), 'password' => Input::get('password'));
            if (Auth::attempt($data)) {
                $data = DB::table('user')->select('user_id', 'level_user', 'username')->where('username', '=', Input::get('username'))->first();
                //print_r($data);
                //echo $data->id_users;
                Session::put('user_id', $data->user_id);
                Session::put('level', $data->level_user);
                Session::put('username', $data->username);
                //print_r(Session::all());
                return Redirect::to("/admin/beranda");
            } else {
                Session::flash('messages', '
					<div class="alert alert-danger alert-dismissable" >
                    		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    		<strong>Peringatan...</strong><br>
                    			Username dan password belum terdaftar pada sistem !
                    		</div>
				');
                return Redirect::to('/')->withInput(Input::except('password'));
            }
        }
    }
开发者ID:komaltech,项目名称:RPPv2,代码行数:30,代码来源:UserController.php

示例3: __construct

 public function __construct()
 {
     // Asset::add('jquery.dropdown.css', 'css/jquery.dropdown.css');
     Asset::add('bootstrap', 'css/bootstrap.min.css');
     Asset::add('bootstrap-responsive', 'css/bootstrap-responsive.css');
     Asset::add('common', 'css/common.css');
     // Asset::add('style', 'css/style.css');
     Asset::add('fontawsome', 'css/fontawesome.css');
     Asset::add('flickcss', 'css/flick/jquery-ui-1.10.2.custom.css');
     Asset::add('jquery', 'js/jquery-1.9.1.js');
     Asset::add('jquery-migrate-1.1.1.js', 'js/jquery-migrate-1.1.1.js');
     Asset::add('bootstrap-js', 'js/bootstrap.js');
     Asset::add('jqueryui', 'js/jquery-ui-1.10.2.custom.min.js');
     Asset::add('jquery.tablesorter.js', 'js/jquery.tablesorter.js');
     Asset::add('jquery.tablesorter.pager.js', 'js/jquery.tablesorter.pager.js');
     // $files = glob("public/css/pikachoose/*.css", GLOB_BRACE);
     // foreach($files as $file)
     // {
     // 	Asset::add($file, substr($file, 7));
     // }
     if (Session::has('id') && Auth::check()) {
         $account = Account::find(Session::get('id'));
         if ($account->admin == 1) {
             Session::put('admin', '1');
         } else {
             Session::put('admin', '0');
         }
         if ($account->blocked == 1) {
             Session::put('alert', "Your account has been banned. Please contact the admin for more details");
             Session::forget('id');
             Auth::logout();
         } else {
         }
     }
 }
开发者ID:angmark0309,项目名称:remarket,代码行数:35,代码来源:base.php

示例4: generate

 public static function generate()
 {
     $token = bin2hex(openssl_random_pseudo_bytes(32));
     if (Session::put(Config::get('session_for_csrf_form_token/timestamp_name'), time())) {
         return Session::put(Config::get('session_for_csrf_form_token/name'), $token);
     }
 }
开发者ID:adiachenko,项目名称:bookshop,代码行数:7,代码来源:Token.php

示例5: validateUser

 /**
  * Validates that no more than 3 failed attempts login to the user sent as a parameter
  * 
  * @param  String $email
  * @return View 
  */
 public static function validateUser($email)
 {
     $count = User::where(['user' => $email])->count();
     if ($count > 0) {
         if (Session::has($email)) {
             $value = Session::get($email);
             if ($value >= 2) {
                 $user = new BlockedUser();
                 $user->user = $email;
                 $user->date = new MongoDate();
                 try {
                     $user->save();
                 } catch (MongoDuplicateKeyException $e) {
                 }
                 $user = User::first(['user' => $email]);
                 $info = UserController::getUser($user);
                 $data = array('name' => strtoupper($info->name));
                 Mail::send('emails.block-user', $data, function ($message) use($email) {
                     $message->to($email)->subject(Lang::get('login.blocked_title'));
                 });
                 return Redirect::back()->withErrors(array('error' => Lang::get('login.attemp') . ' [' . $email . '] ' . Lang::get('login.blocked') . 30 . Lang::get('login.minute')));
             } else {
                 $value += 1;
                 Session::put($email, $value);
             }
         } else {
             Session::put($email, 1);
         }
     }
     return Redirect::back()->withErrors(array('error' => Lang::get('login.invalid_user')));
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:37,代码来源:UserController.php

示例6: registerUser

 /**
  * Invokes the user registration on WS.
  *
  * @return response
  * @throws Exception in case of WS error
  */
 public function registerUser()
 {
     try {
         $userService = new SoapClient(Config::get('wsdl.user'));
         $user = new UserModel(Input::all());
         $array = array("user" => $user, "password" => Input::get('password'), "invitationCode" => Input::get('code'));
         if (Input::get('ref')) {
             $array['referrerId'] = Input::get('ref');
         }
         $result = $userService->registerUser($array);
         $authService = new SoapClient(Config::get('wsdl.auth'));
         $token = $authService->authenticateEmail(array("email" => Input::get('email'), "password" => Input::get('password'), "userAgent" => NULL));
         ini_set('soap.wsdl_cache_enabled', '0');
         ini_set('user_agent', "PHP-SOAP/" . PHP_VERSION . "\r\n" . "AuthToken: " . $token->AuthToken);
         Session::put('user.token', $token);
         try {
             $userService = new SoapClient(Config::get('wsdl.user'));
             $result = $userService->getUserByEmail(array("email" => Input::get('email')));
             $user = $result->user;
             /*	if ($user -> businessAccount == true) {
             				if (isset($user -> addresses) && is_object($user -> addresses)) {
             					$user -> addresses = array($user -> addresses);
             				}
             			}  */
             Session::put('user.data', $user);
             return array('success' => true);
         } catch (InnerException $ex) {
             //throw new Exception($ex -> faultstring);
             return array('success' => false, 'faultstring' => $ex->faultstring);
         }
     } catch (Exception $ex) {
         return array('success' => false, 'faultstring' => $ex->faultstring);
     }
 }
开发者ID:Yatko,项目名称:Gifteng,代码行数:40,代码来源:InviteController.php

示例7: generateOTP

 private function generateOTP()
 {
     function generatePassword($length, $strength)
     {
         $vowels = 'aeuy';
         $consonants = 'bdghjmnpqrstvz';
         if ($strength & 1) {
             $consonants .= 'BDGHJLMNPQRSTVWXZ';
         }
         if ($strength & 2) {
             $vowels .= "AEUY";
         }
         if ($strength & 4) {
             $consonants .= '23456789';
         }
         if ($strength & 8) {
             $consonants .= '@#$%';
         }
         $password = '';
         $alt = time() % 2;
         for ($i = 0; $i < $length; $i++) {
             if ($alt == 1) {
                 $password .= $consonants[rand() % strlen($consonants)];
                 $alt = 0;
             } else {
                 $password .= $vowels[rand() % strlen($vowels)];
                 $alt = 1;
             }
         }
         return $password;
     }
     $this->_CODE = generatePassword(8, 4);
     Session::put('OTPCode', $this->_CODE);
 }
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:34,代码来源:OTP.php

示例8: get_instagram

 public function get_instagram()
 {
     // make sure user is logged in
     if (!Auth::user()) {
         return Redirect::to('/')->withInput()->withErrors('You must be logged in to access the Instagram panel.');
     }
     // configure the API values
     $auth_config = array('client_id' => CLIENT_ID, 'client_secret' => CLIENT_SECRET, 'redirect_uri' => REDIRECT_URI);
     // create a new Auth object using the config values
     $auth = new Instagram\Auth($auth_config);
     // authorize app if not already authorized
     if (!Input::get('code')) {
         $auth->authorize();
     }
     // get the code value returned from Instagram
     $code = Input::get('code');
     $title = 'ImgHost - Instagram';
     // save the access token if not already saved
     if (!Session::get('instagram_access_token')) {
         Session::put('instagram_access_token', $auth->getAccessToken($code));
     }
     // create a new Instagram object
     $instagram = new Instagram\Instagram();
     // set the access token on the newly created Instagram object
     $instagram->setAccessToken(Session::get('instagram_access_token'));
     // get the ID of the authorized user
     $current_user = $instagram->getCurrentUser();
     // access the media of the authorized user
     $media = $current_user->getMedia();
     $db_images = DB::table('images')->get();
     return View::make('instagram')->with('title', $title)->with('instagram_images', $media)->with('db_images', $db_images);
 }
开发者ID:slopedoo,项目名称:laravel,代码行数:32,代码来源:InstagramController.php

示例9: post_profile

 public function post_profile($table, $col_name, $type)
 {
     $this->object = database::get_instance();
     $users = DB::table('users_login')->orderBy('id', 'desc')->first();
     $stu_id = $users->user_session;
     $id = $this->object->view($table, "where_pluck", $col_name, '=', $stu_id, 'id');
     $profile_image = $this->object->view($table, "where_pluck", 'id', '=', $id, 'profile_image');
     Session::put('table', $table);
     if (Auth::attempt(array('password' => Input::get('old_pass')))) {
         if (Input::get('new_pass') == Input::get('pass_confirm')) {
             $this->add_file = $this->object->upload_file('profile_images', $table, 'upload', 'profile_image', "update", 'id', $id, $profile_image);
             $val = array('password' => Hash::make(Input::get('new_pass')));
             $this->object->update($table, 'id', $id, $val);
         } else {
             $return = Redirect::to('profile=' . $type)->with('exists', 'Please Enter Correct new password');
         }
     } else {
         $return = Redirect::to('profile=' . $type)->with('exists', 'Please Enter Correct Old password');
     }
     if ($this->add_file) {
         $return = Redirect::to('profile=' . $type)->with('success', 'You successfully Update Your Profile.');
     } else {
         $return = Redirect::to('profile=' . $type)->with('exists', 'Please Select a file');
     }
     return $return;
 }
开发者ID:Ahmed-Mohamed1994,项目名称:Grade_System_laravel,代码行数:26,代码来源:UserProfile.php

示例10: login

 /**
  * @param $code
  * @return string
  */
 public function login($code)
 {
     $this->client->authenticate($code);
     $token = $this->client->getAccessToken();
     \Session::put('token', $token);
     return $token;
 }
开发者ID:janusnic,项目名称:YoutubeAPI_Demo,代码行数:11,代码来源:GoogleLogin.php

示例11: update

 public function update($id, $quantity)
 {
     $cart = \Session::get('cart');
     $cart[$id]->quantity = $quantity;
     \Session::put('cart', $cart);
     return redirect()->route('cart-show');
 }
开发者ID:Jorgeachaar,项目名称:Krito,代码行数:7,代码来源:CartController.php

示例12: Authenticate

 public function Authenticate($Username = false, $Password = false, $Remember = false)
 {
     if ($Username !== false && $Password !== false) {
         //Confirm Input
         $UserData = DB::getInstance()->table("Users")->where("Username", $Username)->get(1)[0];
         $HashedPassAttempt = Hash::make(Input::get("Password"), $UserData->Salt);
         if ($HashedPassAttempt == $UserData->Password) {
             Session::put("UserID", $UserData->UserID);
             if ($Remember == 'on') {
                 //Was Remember Me Checkbox ticked?
                 $hashCheck = DB::getInstance()->table("user_sessions")->where('user_id', $UserData->UserID)->get();
                 //Check for existing session
                 if (count($hashCheck) == 0) {
                     //If there is not an existing hash
                     $hash = Hash::unique();
                     DB::getInstance()->table('user_sessions')->insert(array('user_id' => $UserData->UserID, 'hash' => $hash));
                 } else {
                     //use existing hash if found
                     $hash = $hashCheck[0]->hash;
                 }
                 $Cookie = Cookie::put(Config::get("remember/cookie_name"), $hash, Config::get("remember/cookie_expiry"));
                 //Set cookie
             }
             return $this->form($UserData->UserID);
             //Return User MetaTable
         } else {
             throw new Exception('Invalid Username or Password');
         }
     } else {
         throw new Exception('Invalid Username or Password');
     }
     return false;
 }
开发者ID:25564,项目名称:Resume,代码行数:33,代码来源:User.php

示例13: login

 /**
  * Display customer login screen.
  * 
  * @return Response
  */
 public function login()
 {
     if (Auth::check()) {
         return Redirect::route('profile');
     } elseif (Request::isMethod('post')) {
         $loginValidator = Validator::make(Input::all(), array('email' => 'required', 'password' => 'required'));
         if ($loginValidator->passes()) {
             $inputCredentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
             if (Auth::attempt($inputCredentials)) {
                 $customer = Customer::find(Auth::id());
                 if ($customer->admin_ind) {
                     Session::put('AdminUser', TRUE);
                 }
                 if (is_null($customer->address)) {
                     // If customer does not have address, redirect to create address.
                     return Redirect::route('customer.address.create', Auth::id())->with('message', 'No address found for account.  Please enter a valid address.');
                 }
                 return Redirect::intended('profile')->with('message', 'Login successful.');
             }
             return Redirect::back()->withInput()->withErrors(array('password' => array('Credentials invalid.')));
         } else {
             return Redirect::back()->withInput()->withErrors($loginValidator);
         }
     }
     $this->layout->content = View::make('customers.login');
 }
开发者ID:marciocamello,项目名称:laravel-ecommerce,代码行数:31,代码来源:CustomersController.php

示例14: getIndex

 public function getIndex()
 {
     Session::put('flag', 11);
     $dados["status_notificacao"] = 2;
     $result = DB::table('pedidos')->where("status_notificacao", 1)->update($dados);
     return View::make("pedidos.pedidos");
 }
开发者ID:jeanfbs,项目名称:Ducheff,代码行数:7,代码来源:PedidoController.php

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


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