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


PHP Auth::member方法代码示例

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


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

示例1: before

 public function before()
 {
     parent::before();
     if (!Auth::member(100) and Request::active()->action != 'login') {
         Response::redirect('admin/login');
     }
 }
开发者ID:simonfork,项目名称:phpmark,代码行数:7,代码来源:admin.php

示例2: action_index

 public function action_index()
 {
     //初期表示
     $view = View::forge('login/index');
     //既にログインしてたら、home画面へリダイレクト
     AUth::check() and Response::redirect('home');
     //エラー文のセット
     $error = null;
     //認証インスタンスの生成
     $auth = Auth::instance();
     //入力項目の取得
     if (Input::post()) {
         //DBとの比較
         if ($auth->login(Input::post('username'), Input::post('password'))) {
             //ログインするユーザのグループが1(学生)の場合
             if (Auth::member(1)) {
                 //学生用home画面にリダイレクト
                 Response::redirect('home');
             } else {
                 if (Auth::member(100)) {
                     //管理者用home画面にリダイレクト
                     Response::redirect('admin');
                 }
             }
         } else {
             $error = 'ユーザ名かパスワードに誤りがあります。';
             $view = View::forge('login/index');
             $view->set('error', $error);
         }
     }
     return $view;
 }
开发者ID:nihonLoomba,项目名称:noteshare-,代码行数:32,代码来源:login.php

示例3: before

 public function before()
 {
     parent::before();
     // check for admin
     if (!Auth::member(5)) {
         \Response::redirect_back('home');
     }
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:8,代码来源:admin.php

示例4: before

 public function before()
 {
     parent::before();
     // Check if the current user is an administrator
     if (!\Auth::member(6)) {
         \Messages::info(__('user.login.permission-denied'));
         \Response::redirect();
     }
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:9,代码来源:post.php

示例5: action_remove

 public function action_remove($user_id)
 {
     // check for admin
     if (!Auth::member(5)) {
         \Response::redirect_back('home');
     }
     $user = Model_User::query()->where('id', $user_id)->get_one();
     $user->delete();
     Response::Redirect('users');
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:10,代码来源:users.php

示例6: before

 public function before()
 {
     parent::before();
     if (Auth::check()) {
         if (!Auth::member(100) and !in_array(Request::active()->action, array('login', 'logout'))) {
             Session::set_flash('error', e('You don\'t have access to the admin panel'));
             Response::redirect('/');
         }
     } else {
         Response::redirect('admin/login');
     }
 }
开发者ID:wushian,项目名称:MDD,代码行数:12,代码来源:admin.php

示例7: before

 public function before()
 {
     parent::before();
     // Check if the current user is an administrator
     if (!\Auth::member(6)) {
         \Messages::warnig(__('user.login.permission-denied'));
         \Response::redirect(\Router::get('backend'));
     }
     $this->template->title = "RN | ADMIN";
     // Set global
     $this->template->title = \Config::get('application.seo.backend.title');
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:12,代码来源:admin.php

示例8: before

 public function before()
 {
     parent::before();
     //ログインしていなければ
     if (!Auth::check()) {
         //ログインページへ移動
         Response::redirect('user/login');
         //ログインしていてもAdminでなければ
     } elseif (!Auth::member(100)) {
         //user/indexページへ移動
         Response::redirect('user/index');
     }
 }
开发者ID:amemiya0222,项目名称:soccer_antena,代码行数:13,代码来源:admin.php

示例9: before

 public function before()
 {
     parent::before();
     if (Request::active()->controller !== 'Controller_Admin' or !in_array(Request::active()->action, array('login', 'logout'))) {
         if (Auth::check()) {
             $admin_group_id = Config::get('auth.driver', 'Simpleauth') == 'Ormauth' ? 6 : 100;
             if (!Auth::member($admin_group_id)) {
                 Session::set_flash('error', e('You don\'t have access to the Admin panel'));
                 Response::redirect('/');
             }
         } else {
             Response::redirect('admin/login');
         }
     }
 }
开发者ID:AfterCursor,项目名称:itnt-time-manager,代码行数:15,代码来源:admin.php

示例10: after

 public function after($response)
 {
     $response = parent::after($response);
     if (Uri::Current() != Uri::Create('login')) {
         if (Settings::get('maintenance_mode') === true) {
             if (!Auth::member(5)) {
                 $this->template->content = View::Forge('core/maintenance');
             } elseif (Uri::Current() != Uri::Create('admin/settings')) {
                 // YOUR GOOD
                 Response::Redirect(Uri::Create('admin/settings'));
             }
         }
     }
     return $response;
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:15,代码来源:template.php

示例11: before

 public function before()
 {
     parent::before();
     // Without this line, templating won't work!
     if (\Auth::check()) {
         // Check if the current user is an administrator
         if (!\Auth::member(100)) {
             \Session::set_flash('error', 'You don\'t have the required access');
             \Response::redirect('auth');
         }
         # Set user info
         $this->template->set_global('auth', ['user' => ['screen_name' => \Auth::get_screen_name(), 'group' => \Auth::group()->get_name()]], false);
     } else {
         \Response::redirect('auth');
     }
 }
开发者ID:vano00,项目名称:jobs,代码行数:16,代码来源:admin.php

示例12: action_login

 public function action_login()
 {
     // Already logged in
     Auth::member(100) and Response::redirect('admin');
     $val = Validation::forge();
     if (Input::method() == 'POST') {
         $val->add('email', 'Email or Username')->add_rule('required');
         $val->add('password', 'Password')->add_rule('required');
         if ($val->run()) {
             $auth = Auth::instance();
             // check the credentials. This assumes that you have the previous table created
             if (Auth::check() or $auth->login(Input::post('email'), Input::post('password'))) {
                 // credentials ok, go right in
                 $current_user = Model_User::find_by_username(Auth::get_screen_name());
                 Session::set_flash('success', e('Welcome, ' . $current_user->username));
                 Response::redirect('admin');
             } else {
                 $this->template->set_global('login_error', 'Fail');
             }
         }
     }
     $this->template->title = 'Login';
     $this->template->content = View::forge('admin/login', array('val' => $val), false);
 }
开发者ID:nobuhiko,项目名称:mylogbook,代码行数:24,代码来源:admin.php

示例13: action_delete

 public function action_delete($url_id)
 {
     $url = Model_Url::find($url_id);
     if ($url->user_id != static::$user_id && !Auth::member(5)) {
         Session::set('error', 'This isn\'t your URL!');
         Response::Redirect_Back('user/urls');
     } else {
         if ($url->delete()) {
             $url_stats = Model_Url_Stat::query()->where('url_id', $url_id)->rows_limit(1)->limit(1)->count();
             if (empty($url_stats) === false) {
                 $url_stats = DB::delete('url_stats')->where('url_id', $url_id)->execute();
             }
             Session::set('success', 'Url has been deleted!');
             Response::Redirect_Back('user/urls');
         } else {
             Session::set('error', 'Unknown Error!');
             Response::Redirect_Back('user/urls');
         }
     }
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:20,代码来源:url.php

示例14: action_view

 public function action_view($all = null)
 {
     $limit = 25;
     if (empty($all) === false) {
         // check for admin
         if (!Auth::member(5)) {
             Response::Redirect(Uri::Create('user'));
         }
     }
     // Total Urls
     $data['total_urls'] = Model_Url::query();
     if (empty($all) === true) {
         $data['total_urls']->where('user_id', static::$user_id);
     }
     $data['total_urls'] = $data['total_urls']->count();
     if (Uri::Current() == Uri::Create('admin')) {
         $keys = \Settings::Get('character_set');
         if (empty($keys) === true) {
             $keys = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
         }
         $random_length = \Settings::Get('random_url_length');
         if (empty($random_length) === true) {
             $random_length = 5;
         }
         $url_sample_space = DB::select(DB::expr('count(id) as count'))->from('urls')->where(DB::expr('char_length(short_url)'), $random_length)->limit(1)->execute()->as_array();
         $data['urls_left'] = Controller_Dashboard::mathFact(strlen($keys)) / (Controller_Dashboard::mathFact(strlen($keys) - $random_length) * Controller_Dashboard::mathFact($random_length)) - $url_sample_space[0]['count'];
     }
     // Total Hits
     $data['total_hits'] = DB::select(DB::Expr('SUM(hits) as hits'))->from('urls');
     if (empty($all) === true) {
         $data['total_hits']->where('user_id', static::$user_id);
     }
     $data['total_hits'] = $data['total_hits']->execute()->as_array();
     $data['total_hits'] = reset($data['total_hits']);
     $data['total_hits'] = $data['total_hits']['hits'];
     // No Clicks
     $data['no_clicks'] = Model_Url::query()->where('hits', 0);
     if (empty($all) === true) {
         $data['no_clicks']->where('user_id', static::$user_id);
     }
     $data['no_clicks'] = $data['no_clicks']->count();
     // Total Custom Urls
     $data['total_custom_urls'] = Model_Url::query()->where('custom', 1);
     if (empty($all) === true) {
         $data['total_custom_urls']->where('user_id', static::$user_id);
     }
     $data['total_custom_urls'] = $data['total_custom_urls']->count();
     // Created Today Urls
     $data['created_today'] = Model_Url::query()->where('created_at', '>=', strtotime('today 12:01 AM'));
     if (empty($all) === true) {
         $data['created_today']->where('user_id', static::$user_id);
     }
     $data['created_today'] = $data['created_today']->count();
     // Most visted Urls
     $data['most_visited'] = Model_Url::query();
     if (empty($all) === true) {
         $data['most_visited']->where('user_id', static::$user_id);
     }
     $data['most_visited']->order_by('hits', 'desc')->limit($limit);
     $data['most_visited'] = $data['most_visited']->get();
     // Created Today Urls
     $data['recently_created'] = Model_Url::query();
     if (empty($all) === true) {
         $data['recently_created']->where('user_id', static::$user_id);
     }
     $data['recently_created']->order_by('created_at', 'desc')->limit($limit);
     $data['recently_created'] = $data['recently_created']->get();
     if (empty($all) === true) {
         $data['recently_viewed'] = Model_Url::query()->order_by('updated_at', 'desc')->where('updated_at', '!=', 'created_at')->where('user_id', static::$user_id)->limit($limit)->get();
     } else {
         $data['recently_viewed'] = Model_Url::query()->order_by('updated_at', 'desc')->where('updated_at', '!=', null)->limit($limit)->get();
     }
     // Short URL Stats string for google graphs
     $m = date("m");
     $de = date("d");
     $y = date("Y");
     $new_results = '';
     if (empty($all) === true) {
         $date_vist_counts = DB::query('  
             SELECT
             COUNT(url_stats.id) as hits,
             DAY(FROM_UNIXTIME(url_stats.created_at)) as day,
             MONTH(FROM_UNIXTIME(url_stats.created_at)) as month,
             YEAR(FROM_UNIXTIME(url_stats.created_at)) as year
             FROM `url_stats`
             INNER JOIN `urls` ON urls.id = url_stats.url_id
             WHERE url_stats.created_at >= ' . strtotime('12:01 AM TODAY - 15 days') . '
             AND urls.user_id = ' . static::$user_id . '
             GROUP BY year,month,day')->execute()->as_array();
         $date_created_counts = DB::query('  
             SELECT
             COUNT(id) as created,
             DAY(FROM_UNIXTIME(created_at)) as day,
             MONTH(FROM_UNIXTIME(created_at)) as month,
             YEAR(FROM_UNIXTIME(created_at)) as year
             FROM `urls`
             WHERE created_at >= ' . strtotime('12:01 AM TODAY - 15 days') . '
             AND user_id = ' . static::$user_id . '
             GROUP BY year,month,day')->execute()->as_array();
     } else {
//.........这里部分代码省略.........
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:101,代码来源:dashboard.php

示例15:

        } else {
            ?>
                                            <td>
                                                <a data-text="This URL will be removed!" class="confirm" href="<?php 
            echo Uri::Create('url/delete/' . $url->id);
            ?>
">
                                                    <i class="icon-remove"></i></a> <a target="_blank" id="url_<?php 
            echo $url->id;
            ?>
" href="<?php 
            echo $url->url;
            ?>
">
                                                    <?php 
            if (Auth::member(5) && Uri::Create('admin/urls') == Uri::Current()) {
                $url_parts = parse_url($url->url);
                $host = $url_parts['host'];
                ?>
                                                            <a class="confirm" data-text="All URLs LIKE <?php 
                echo $host;
                ?>
 will be blocked!" href="<?php 
                echo Uri::Create('admin/add_blocked/' . str_replace('.', '-', $host) . '');
                ?>
">
                                                                <i class="icon-ban-circle"></i>
                                                            </a>
                                                        <?php 
            }
            ?>
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:31,代码来源:list.php


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