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


PHP Auth::checkAuth方法代码示例

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


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

示例1: actionShowLesson

 public function actionShowLesson()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if (!isset($_GET['id'])) {
         header("Location: /learns/");
     }
     if ($auth) {
         $user = Auth::getUser();
         $id = $_GET['id'];
         $lesson = Lessons::getLesson($id);
         $course = Courses::getCourse($lesson->course_id);
         $lesson_prew = Lessons::getLessonByNumber($lesson->lesson_number - 1, $lesson->course_id);
         $lesson_next = Lessons::getLessonByNumber($lesson->lesson_number + 1, $lesson->course_id);
         $view->user_login = $user->user_login;
         $view->user_group = $user->user_group;
         $view->lesson = $lesson;
         $view->course = $course;
         $view->lesson_prew = $lesson_prew;
         $view->lesson_next = $lesson_next;
         $view->display('header.php');
         $view->display('lessons/lesson_view.php');
         $view->display('footer.php');
     } else {
         header("Location: /learns/");
     }
 }
开发者ID:AK-VoronM,项目名称:learns,代码行数:28,代码来源:LessonsController.php

示例2: checkAuth

 /**
  * checkAuth
  *
  * PEAR::Auth標準の認証処理に加えて、OPENPNE_URL及び
  * USER_AGENTのチェックもおこなう
  *
  * @return bool
  * @see PEAR::Auth::checkAuth
  */
 function checkAuth()
 {
     if (!$this->auth->checkAuth()) {
         return false;
     }
     if (OPENPNE_SESSION_CHECK_URL) {
         $openpne_url = $this->auth->getAuthData('OPENPNE_URL');
         if ($openpne_url !== OPENPNE_URL) {
             return false;
         }
     }
     if ($this->is_check_user_agent) {
         $login_user_agent = $this->auth->getAuthData('USER_AGENT');
         $now_user_agent = $_SERVER['HTTP_USER_AGENT'];
         // ドコモ端末からのアクセスの場合、ユーザエージェント情報から個体識別情報を取り除く
         if ($GLOBALS['__Framework']['carrier'] == 'i') {
             if (strncmp($now_user_agent, 'DoCoMo/1.0', 10) === 0) {
                 $login_user_agent = substr($login_user_agent, 0, strpos($login_user_agent, '/ser'));
                 $now_user_agent = substr($now_user_agent, 0, strpos($now_user_agent, '/ser'));
             } elseif (strncmp($now_user_agent, 'DoCoMo/2.0', 10) === 0) {
                 $login_user_agent = substr($login_user_agent, 0, strpos($login_user_agent, '('));
                 $now_user_agent = substr($now_user_agent, 0, strpos($now_user_agent, '('));
             }
         }
         if ($now_user_agent !== $login_user_agent) {
             return false;
         }
     }
     return true;
 }
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:39,代码来源:Auth.php

示例3: actionShow

 public function actionShow()
 {
     $id = $_GET['id'];
     $auth = Auth::checkAuth();
     if ($auth) {
         $user = Users::findOneByPK($auth);
         $user->getProfile();
     }
     $courses = Courses::findAllByColumn('parent_id', $id);
     $view = new View();
     $view->user = $user;
     $view->courses = $courses;
     //  $view->user_login = $user->user_login;
     // $view->user_group = $user->user_group;
     $parent_course = Courses::findOneByPK($id);
     $crumbs = Breadcrumbs::getCrumbs($parent_course);
     $view->crumbs = $crumbs;
     $view->page_title = $parent_course->name;
     $view->display('header.php');
     if (isset($id)) {
         $view->display('courses/child-list.php');
     } else {
         $view->display('courses/list.php');
     }
     $view->display('footer.php');
 }
开发者ID:AK-VoronM,项目名称:edu-znatok,代码行数:26,代码来源:CoursesController.php

示例4: actionRegister

 public function actionRegister()
 {
     $auth = Auth::checkAuth();
     if (!$auth) {
         $view = new View();
         $view->display('header.php');
         $view->display('auth/register.php');
         $view->display('footer.php');
     } else {
         header("Location: " . BASE_PATH . 'users/');
     }
 }
开发者ID:AK-VoronM,项目名称:edu-znatok,代码行数:12,代码来源:AuthController.php

示例5: loginAuth

 /**
  * Uses PEAR's Auth class to authenticate the user against a container.
  * This allows us to use LDAP, a different database or some other
  * external system.
  *
  * @param string $username Username to check
  * @param string $password Password to check
  *
  * @return boolean If the user has been successfully authenticated or not
  */
 public function loginAuth($username, $password)
 {
     $this->auth->post = array('username' => $username, 'password' => $password);
     $this->auth->start();
     if (!$this->auth->checkAuth()) {
         return false;
     }
     //put user in database
     if (!$this->getUserByUsername($username)) {
         $this->addUser($username, $password, $username . $GLOBALS['authEmailSuffix']);
     }
     return true;
 }
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:23,代码来源:AuthUser.php

示例6: actionPanel

 public function actionPanel()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         $view->display('header.php');
         $view->display('admin/main.php');
         $view->display('footer.php');
         $view->admin = $admin;
     } else {
         header("Location: /learns/");
     }
 }
开发者ID:AK-VoronM,项目名称:learns,代码行数:15,代码来源:AdminController.php

示例7: actionShow

 public function actionShow()
 {
     $courses = Courses::findAllByColumn('parent_id', 0);
     $auth = Auth::checkAuth();
     if ($auth) {
         $user = Users::findOneByPK($auth);
         $user->getProfile();
     }
     $view = new View();
     $view->user = $user;
     $view->courses = $courses;
     //  $view->user_login = $user->user_login;
     // $view->user_group = $user->user_group;
     $view->display('header.php');
     $view->display('content.php');
     $view->display('footer.php');
 }
开发者ID:AK-VoronM,项目名称:edu-znatok,代码行数:17,代码来源:IndexController.php

示例8: actionShowAll

 public function actionShowAll()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         $courses = Courses::getCourses();
         $view->user_login = $user->user_login;
         $view->user_group = $user->user_group;
         $view->courses = $courses;
         $view->display('header.php');
         $view->display('courses/courses_list.php');
         $view->display('footer.php');
     } else {
         header("Location: /learns/");
     }
 }
开发者ID:AK-VoronM,项目名称:learns,代码行数:18,代码来源:CoursesController.php

示例9: actionShow

 public function actionShow()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         $view->user_login = $user->user_login;
         $view->user_group = $user->user_group;
     }
     if ($auth) {
         header("Location: /learns/?ctrl=Courses&act=ShowAll");
     } else {
         $view->display('header.php');
         $view->display('auth/auth.php');
         $view->display('footer.php');
     }
 }
开发者ID:AK-VoronM,项目名称:learns,代码行数:18,代码来源:IndexController.php

示例10: actionShowUsers

 public function actionShowUsers()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         if ($user->user_group == 1) {
             $view->user_login = $user->user_login;
             $view->user_group = $user->user_group;
             $view->users = Users::getUsers();
             $view->display('header.php');
             $view->display('users/user_list.php');
         }
         $view->display('footer.php');
     } else {
         header("Location: /learns/");
     }
 }
开发者ID:AK-VoronM,项目名称:learns,代码行数:19,代码来源:UsersController.php

示例11: actionSave

 public function actionSave()
 {
     $data_array = $_POST;
     if (!empty($data_array)) {
         $user = Users::findOneByPK(Auth::checkAuth());
         $user->getProfile();
         foreach ($data_array as $key => $value) {
             $user->{$key} = $value;
         }
         if (!empty($_FILES['img']['name'])) {
             $user->img = Files::upload($_FILES, 'users');
         } else {
             $user->img = 'img/defaults/owl00' . rand(1, 6) . '.png';
         }
         $user->saveProfile();
     } else {
         header('Location: ' . BASE_PATH . 'auth/');
     }
     header('Location: ' . BASE_PATH . 'users/');
 }
开发者ID:AK-VoronM,项目名称:edu-znatok,代码行数:20,代码来源:UsersController.php

示例12: actionLesson

 public function actionLesson()
 {
     $auth = Auth::checkAuth();
     if ($auth) {
         $user = Users::findOneByPK($auth);
         $user->getProfile();
     }
     $lesson_id = $_GET['lesson_id'];
     $view = new View();
     //  $view->user_login = $user->user_login;
     // $view->user_group = $user->user_group;
     if (isset($lesson_id)) {
         $lesson = Lessons::findOneByPK($lesson_id);
         $crumbs = Breadcrumbs::getCrumbs($lesson);
         $view->page_title = $lesson->name;
         $view->crumbs = $crumbs;
         $view->user = $user;
         $view->display('header.php');
         $view->display('lessons/lesson.php');
         $view->display('footer.php');
     } else {
         throw new ControllerException('Сожалеем, такого урока не существует', '404');
     }
 }
开发者ID:AK-VoronM,项目名称:edu-znatok,代码行数:24,代码来源:LessonsController.php

示例13: DatabaseConnections

            break;
        case -5:
            $errro = "Security Issue. Please login again";
            break;
        default:
            $error = "Authentication Issue. Please report to Admin";
    }
    if (isset($error)) {
        $templateEngine->assign("error", $error);
    }
    $templateEngine->displayPage('usermin_login.tpl');
    exit;
}
$DatabaseConnections = new DatabaseConnections();
$Usermin = new DatabaseUsermin($DatabaseConnections->getRadiusDB());
$options = array('cryptType' => 'none', 'users' => $Usermin->getUsers());
$Auth = new Auth("Array", $options, "loginForm");
$Auth->setSessionName("GRASE Usermin");
$Auth->setAdvancedSecurity(array(AUTH_ADV_USERAGENT => true, AUTH_ADV_IPCHECK => true, AUTH_ADV_CHALLENGE => false));
$Auth->setIdle(120);
$Auth->start();
if (!$Auth->checkAuth()) {
    echo "Should never get here";
    // THIS CODE SHOULD NEVER RUN
    exit;
} elseif (isset($_GET['logoff'])) {
    $Auth->logout();
    $Auth->start();
} else {
    $templateEngine->assign("LoggedInUsername", $Auth->getUsername());
}
开发者ID:KuberKode,项目名称:grase-www-portal,代码行数:31,代码来源:usermin_session.inc.php

示例14: myLogin

<?php

require_once 'Auth/Auth.php';
// 認証フォーム呼び出しのためのユーザ定義関数
function myLogin($usr, $status)
{
    // エラーメッセージ(の候補)を連想配列で準備
    $errs = array(AUTH_IDLED => 'アイドル時間を超えています。再ログインしてください。', AUTH_EXPIRED => '時間切れです。再ログインしてください。', AUTH_WRONG_LOGIN => 'ユーザ/パスワードが誤っています。');
    // 認証フォーム呼び出し
    require_once 'login.php';
}
// Authクラスのインスタンス化
$auth = new Auth('MDB2', array('dsn' => 'mysqli://hiroki:birthday0923@localhost/selfphp', 'table' => 'usr', 'usernamecol' => 'uid', 'passwordcol' => 'passwd', 'db_fields' => '*'), 'myLogin');
// 認証処理の実行
$auth->start();
// 認証の成否を判定(未認証、認証失敗時にはスクリプトを終了)
if (!$auth->checkAuth()) {
    die;
}
开发者ID:hiroki-ta,项目名称:my.project,代码行数:19,代码来源:MyAuth.php

示例15: array

}
class Auth_Log_Observer extends Log_observer
{
    var $messages = array();
    function notify($event)
    {
        $this->messages[] = $event;
    }
}
$options = array('enableLogging' => true, 'cryptType' => 'md5', 'users' => array('guest' => md5('password')));
$a = new Auth("Array", $options, "loginFunction");
$infoObserver = new Auth_Log_Observer(AUTH_LOG_INFO);
$a->attachLogObserver($infoObserver);
$debugObserver = new Auth_Log_Observer(AUTH_LOG_DEBUG);
$a->attachLogObserver($debugObserver);
$a->start();
if ($a->checkAuth()) {
    /*
     * The output of your site goes here.
     */
    print "Authentication Successful.<br/>";
}
print '<h3>Logging Output:</h3>' . '<b>AUTH_LOG_INFO level messages:</b><br/>';
foreach ($infoObserver->messages as $event) {
    print $event['priority'] . ': ' . $event['message'] . '<br/>';
}
print '<br/>' . '<b>AUTH_LOG_DEBUG level messages:</b><br/>';
foreach ($debugObserver->messages as $event) {
    print $event['priority'] . ': ' . $event['message'] . '<br/>';
}
print '<br/>';
开发者ID:klofac,项目名称:combros,代码行数:31,代码来源:logging.php


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