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


PHP Auth::Check方法代码示例

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


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

示例1: before

 public function before()
 {
     parent::before();
     if (Auth::Check() === false) {
         Response::Redirect(Uri::Base());
     }
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:7,代码来源:dashboard.php

示例2: before

 public function before()
 {
     parent::before();
     if (\Settings::Get('signup_and_approve') === true && Auth::Check() === false) {
         Response::Redirect(Uri::Create('signup'));
     }
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:7,代码来源:url.php

示例3: getEvents

 /**
  * Responds to requests to GET /events
  */
 public function getEvents()
 {
     $events = \Interested\Event::orderBy('updated_at', 'desc')->with('user')->get();
     $eventsForCheckboxes = [];
     $user = new \Interested\User();
     if (\Auth::Check()) {
         $eventsForCheckboxes = $user->getEventsForCheckboxes();
     }
     return view('events.index')->with(['events' => $events, 'eventsForCheckboxes' => $eventsForCheckboxes]);
 }
开发者ID:Anjalichimnani,项目名称:interested,代码行数:13,代码来源:EventController.php

示例4: getFM

 public function getFM()
 {
     if (Auth::Check()) {
         if (Auth::User()->isAdmin()) {
             return View::make('filemaintenance.filemaintenance');
         } else {
             return Redirect::Route('home');
         }
     } else {
         return Redirect::Route('home');
     }
 }
开发者ID:jhunel2389,项目名称:baeyaya-dev,代码行数:12,代码来源:FileMaintenanceController.php

示例5: before

 public function before()
 {
     // Lets render the template
     parent::before();
     // Check to see if the config exsists
     if (file_exists(APPPATH . 'config/production/db.php') === false) {
         Response::Redirect('install');
     }
     if (DBUtil::field_exists('urls', array('cached_preview')) === false && file_exists(APPPATH . 'classes/controller/upgrade.php')) {
         Response::Redirect(Uri::Create('upgrade'));
     }
     $real_base_url = Config::get('base_url');
     Config::set('base_url', str_replace('public/', '', $real_base_url));
     $base_url = Settings::get('different_short_url');
     if (empty($base_url) === false) {
         View::set_global(array('base_url' => $base_url), false, false);
     }
     if (trim(Uri::Base(), '/') == Settings::get('different_short_url')) {
         if (count(Uri::Segments()) == 2) {
             $route = Uri::to_assoc();
             if (isset($route) === true && $route['core'] == '404') {
                 // We are good!
             } else {
                 Response::Redirect(Settings::Get('base_url'));
             }
         } else {
             Response::Redirect(Settings::Get('base_url'));
         }
     }
     $data = null;
     if (Auth::Check()) {
         $user_id = Auth::get_user_id();
         static::$user_id = $user_id[1];
         $data['api_key'] = Auth::get('api_key');
         if (empty($data['api_key']) === true) {
             if (empty($data['api_key']) === true) {
                 $data['api_key'] = preg_replace('/\\+|\\/|\\=|\\?/', '', \Auth::instance()->hash_password(\Str::random()) . static::$user_id);
                 // invalidate the hash
                 \Auth::update_user(array('api_key' => $data['api_key']), Auth::get('username'));
             }
         }
     }
     // Lets set the default title , you can change it when calling the view
     $this->template->title = ucwords(str_replace('controller_', '', strtolower($this->request->route->controller)));
     try {
         Module::load('image');
         $this->template->image_js = true;
     } catch (Exception $e) {
     }
     // Lets get the header and footer and set a variable to use within the template
     $this->template->footer = View::forge('core/footer', $data);
     $this->template->header = View::forge('core/header');
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:53,代码来源:template.php

示例6: action_login

 public function action_login($provider = null)
 {
     if (\Auth::Check()) {
         $user = Model_User::query()->related('user_providers')->where('id', static::$user_id)->get_one();
         if (empty($user->user_providers) === false) {
             $provider_array = array();
             foreach ($user->user_providers as $provider) {
                 $provider_array[] = $provider->provider;
             }
         }
         if (in_array($provider, $provider_array)) {
             Response::Redirect(Uri::Base());
         }
     }
     // bail out if we don't have an OAuth provider to call
     if ($provider === null) {
         \Response::redirect_back();
     }
     // load Opauth, it will load the provider strategy and redirect to the provider
     \Auth_Opauth::forge();
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:21,代码来源:auth.php

示例7: confirmation

 public function confirmation($code, $id)
 {
     /*$genders = Gender::all();
     		$months = Month::all();
     		$user = User::find($id);*/
     $account = User::find($id);
     if ($account['vCode'] == $code) {
         $account['isVerified'] = 1;
         if ($account->save()) {
             if (Auth::Check()) {
                 return View::make('index')->with('mt', "HOME")->with('alert', 'success')->with('msg', 'You already confirmed your email');
                 //return Redirect::Route('home')->with('success','You already confirmed your email');
             } else {
                 return View::make('index')->with('mt', "HOME")->with('alert', 'success')->with('msg', 'You already confirmed your email. Please log in now.');
                 //return Redirect::Route('home')->with('success','You already confirmed your email. Please log in now.');
             }
         } else {
             return View::make('index')->with('mt', "HOME")->with('alert', 'fail')->with('msg', 'Fail to verify your email. please try again.');
             //return Redirect::Route('home')->with('fail','Fail to verify your email. please try again.');
         }
     }
 }
开发者ID:jhunel2389,项目名称:baeyaya-dev,代码行数:22,代码来源:ConfirmationController.php

示例8:

Route::get('/register/confirm/{activation}', ['as' => 'Home', 'uses' => 'HomeController@getActivateUser']);
Route::get('/', ['as' => 'Home', 'uses' => 'HomeController@getIndex']);
Route::get('/home', ['as' => 'Home', 'uses' => 'HomeController@getIndex']);
// Authentication routes...
Route::get('auth/login', ['uses' => 'Auth\\AuthController@getLogin', 'as' => 'login']);
Route::post('auth/login', 'AuthController@postIndex');
Route::get('auth/logout', 'Auth\\AuthController@getLogout');
// Registration routes...
Route::get('auth/register', 'HomeController@getRegister');
Route::post('auth/register', 'HomeController@postRegister');
Route::get('/main', ['uses' => 'HomeController@getMain']);
Route::get('/aboutUs', ['uses' => 'HomeController@getAboutUs']);
Route::get('/contactUs', ['uses' => 'HomeController@getContactUs']);
Route::get('/storage-and-preparation-equipment', ['uses' => 'HomeController@getStorageAndPreparationEquipment']);
Route::get('/cooking-equipment', ['uses' => 'HomeController@getCookingEquipment']);
Route::get('/foodService', ['uses' => 'HomeController@getFoodService']);
Route::get('/product/{id}', ['uses' => 'HomeController@getItemDescription']);
Route::post('/product/{id}', ['uses' => 'HomeController@postItemDescription']);
Route::get('/mycart', ['uses' => 'HomeController@getMyCart']);
Route::post('/mycart', ['uses' => 'HomeController@postMyCart']);
$uses = Auth::Check() ? 'HomeController@postCheckoutFinal' : 'HomeController@postCheckout';
Route::post('/checkout', ['uses' => $uses]);
Route::get('/checkout', ['uses' => $uses]);
Route::post('/review', ['uses' => 'HomeController@postCheckoutFinal']);
Route::get('/review', ['uses' => 'HomeController@getCheckoutFinal', 'middleware' => 'auth']);
Route::get('/myaccount', ['uses' => 'HomeController@getMyAccount', 'middleware' => 'auth']);
Route::post('/myaccount', ['uses' => 'HomeController@postMyAccount', 'middleware' => 'auth']);
Route::get('/myorders', ['uses' => 'HomeController@getMyOrders', 'middleware' => 'auth']);
Route::get('/order/{id}', ['middleware' => 'auth', 'uses' => 'HomeController@getOrder']);
Route::post('/order/{id}', ['middleware' => 'auth', 'uses' => 'HomeController@postOrder']);
Route::get('/searchproduct', ['uses' => 'HomeController@postSearchProduct']);
开发者ID:abrenicamarkjoshua,项目名称:gomeco,代码行数:31,代码来源:routes.php

示例9:

<?php

/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    if (Auth::Check()) {
        $throttle = Sentry::findThrottlerByUserId(Auth::User()->id);
        if ($throttle->isSuspended() || $throttle->isBanned()) {
            Auth::logout();
            return Redirect::to('/')->with('global_error', 'Depends on violation, your account has been suspended or banned.');
        }
    }
});
App::after(function ($request, $response) {
    //
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
开发者ID:Belar,项目名称:librific,代码行数:31,代码来源:filters.php

示例10: ReCaptcha

if (isset($_POST['submit'])) {
    if (!isset($_POST['g-recaptcha-response'])) {
        $msg = "Капча не установлена";
    } else {
        require_once "recaptchalib.php";
        $recaptcha = $_POST['g-recaptcha-response'];
        // ваш секретный ключ
        $secret = "6LflFhYTAAAAAF01b0XPvv4HlHfEbD_rSPcnN9Dx";
        $reCaptcha = new ReCaptcha($secret);
        $response = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $recaptcha);
        if ($response->success) {
            $login = $_POST['login'];
            $password = $_POST['password'];
            $auth = new Auth();
            # Если нет ошибок, то добавляем в БД нового пользователя
            $err = $auth->Check($login, $password);
            if (count($err) == 0) {
                $auth->Register($login, $password);
                //header("Location: login.php"); exit();
                header("Location: /chat/check.php");
                exit;
            } else {
                print "При регистрации произошли следующие ошибки:\n";
                foreach ($err as $error) {
                    print $error . "\n";
                }
            }
        }
    }
}
include 'register.html';
开发者ID:russlanpsu,项目名称:wwwroot,代码行数:31,代码来源:register.php

示例11: postAddPaper

 public function postAddPaper()
 {
     if (\Auth::Check()) {
         $data = Input::all();
         array_pop($data);
         $rules = ['subject' => 'required', 'year' => 'required', 'semester' => 'required'];
         $validator = Validator::make($data, $rules);
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator->errors())->withInput();
         } else {
             if (Input::hasFile('file')) {
                 if (Input::file('file')->isValid()) {
                     $destinationPath = 'papers';
                     // upload path
                     $extension = Input::file('file')->getClientOriginalExtension();
                     // getting image extension
                     if ($extension == 'pdf') {
                         $fileName = $data['subject'] . '_' . $data['year'] . '_' . $data['semester'] . '.' . $extension;
                         // renameing image
                         Input::file('file')->move($destinationPath, $fileName);
                         // uploading file to given path
                         $paper = new Papers();
                         $paper->name = $fileName;
                         $path->path = $destinationPath;
                         $paper->save();
                     }
                 }
             }
             Session::flash('err', "1");
             return redirect('view_papers');
         }
     } else {
         return redirect('login');
     }
 }
开发者ID:ncs-jss,项目名称:library,代码行数:35,代码来源:UserController.php

示例12: function

            $contents[] = $node;
        }
    }
    # done
    return $contents;
}
$app->post('/api/connect', function (Request $request) use($app, $db, $auth) {
    $login = $request->get('username');
    $password = $request->get('password');
    if ($auth->Login($login, $password)) {
        return $_COOKIE['session'];
    }
    return '';
});
$app->post('/api/disconnect', function (Request $request) use($app, $db, $auth) {
    if ($auth->Check($_COOKIE['session'])) {
        $date = new DateTime();
        $hash = sha1(rand() * 992301230 . $date->getTimestamp());
        setcookie('session', null, -1, '/');
        $results = $db->query('UPDATE accounts SET  hash="' . $hash . '" WHERE hash="' . $_COOKIE['session'] . '"');
        session_destroy();
        return '1';
    }
    return '';
});
$app->post('/api/synchronize', function () use($app, $db) {
    if (IsValidSession($db)) {
        $uploaddir = '../uploads/' . $_SESSION['username'] . "/";
        $uploadfile = $uploaddir . basename($_FILES['file']['name']);
        if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
        } else {
开发者ID:hendrik-weiler,项目名称:DataEncrypterService,代码行数:31,代码来源:index.php

示例13: getAddPapers

 public function getAddPapers()
 {
     $menu = Menu::Orderby('id', 'des')->get();
     if (\Auth::Check()) {
         $user = User::where('username', Session::get('username'))->first();
         if ($user->level == 0) {
             if (Session::get('err') == '1') {
                 return view('add_paper', ['err' => "The Paper has been added."])->with('username', $user->username)->with('level', $user->level)->with('menu', $menu);
             } else {
                 return view('add_paper')->with('username', $user->username)->with('level', $user->level)->with('err', "")->with('menu', $menu);
             }
         } else {
             return redirect('/');
         }
     } else {
         return redirect('login');
     }
 }
开发者ID:ncs-jss,项目名称:library,代码行数:18,代码来源:AdminPagesController.php

示例14: Auth

<?php

include "auth.class.php";
/*ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);*/
// Страница регситрации нового пользователя
if (isset($_POST['submit'])) {
    $login = $_POST['login'];
    $password = $_POST['password'];
    $auth = new Auth($login, $password);
    # Если нет ошибок, то добавляем в БД нового пользователя
    $err = $auth->Check();
    if (count($err) == 0) {
        $auth->Register();
        //header("Location: login.php"); exit();
        header("Location: check.php");
        exit;
    } else {
        print "При регистрации произошли следующие ошибки:\n    ";
        foreach ($err as $error) {
            print $error . "\n";
        }
    }
}
?>
<span>Регистрация</span>
<form method="POST">
 Логин <input name="login" type="text">Пароль <input name="password" type="password">
 <input name="submit" type="submit" value="Зарегистрироваться">
</form>
开发者ID:russlanpsu,项目名称:wwwroot,代码行数:31,代码来源:register.php

示例15: getViewPapers

 public function getViewPapers()
 {
     $menu = Menu::Orderby('id', 'des')->get();
     $papers = Papers::Orderby('id', 'des')->get();
     $id = 1;
     if (\Auth::Check()) {
         $user = User::where('username', Session::get('username'))->first();
         return view('papers')->with('papers', $papers)->with('id', $id)->with('username', $user->username)->with('level', $user->level)->with('menu', $menu);
     } else {
         return redirect('login');
     }
 }
开发者ID:ncs-jss,项目名称:library,代码行数:12,代码来源:PagesController.php


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