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


PHP Authenticate::authenticate方法代码示例

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


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

示例1: login

 /**
  * check administrator authentication
  * role: administrator
  */
 public function login()
 {
     if (Authenticate::is_authorized()) {
         transport("dashboard");
     } else {
         $model_administrator = new Authenticate();
         /*
          * populate login data for administrator
          * use setter method to registering information of authentication
          */
         $model_administrator->set_email($_POST['username']);
         $model_administrator->set_password($_POST['password']);
         $model_administrator->set_type(Authenticate::SUPERUSER);
         $login = $model_administrator->authenticate();
         /*
          * $login variable contain array which have 2 keys [granted] and [state]
          * granted {true|false} and state {active|pending}
          * just grant credential that return active and match email and password
          */
         if ($login["granted"] && $login["state"] == User::ACTIVE) {
             transport("dashboard");
         } else {
             $_SESSION['operation'] = 'error';
             $_SESSION['message'] = $login["state"];
             transport("administrator");
         }
     }
 }
开发者ID:anggadarkprince,项目名称:web-businesscareer,代码行数:32,代码来源:AdministratorController.php

示例2: Authenticate

    $DBSERVER = $settings['database']['host'];
    $DBDRIVER = $settings['database']['driver'];
} else {
    $template = $twig->loadTemplate('error.tmpl');
    echo $template->render(array('pageTitle' => "OSCAR - ERROR", 'error' => "Unable to open the configuration file 'config/config.ini.php'"));
    // No point in continuing, kill ourself
    die;
}
/**
 * Check if the user is logged in or not
 */
//$priv = authenticate();
$priv = false;
if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
    $auth = new Authenticate();
    $priv = $auth->authenticate($_SESSION['username'], $_SESSION['password']);
}
/**
 * Test to load data before the asset form is displayed in preparation of using templates
 *
 * N O T E : Added 2016-07-22
 *           The following will be phased out as the class Utilities will be replaced
 *           by Asset and DbHandler...
 */
include_once "classes/Utilities.class.php";
$utilDb = mysqli_connect($DBSERVER, $DBUSER, $DBPASSWD, $DBNAME);
if ($utilDb->connect_error) {
    echo "Database connection failed: " . $utilDb->connect_error;
} else {
    $utils = new Utilities($utilDb);
    //$assetCnt  = $utils->getCount();
开发者ID:druus,项目名称:oscar,代码行数:31,代码来源:index.php

示例3: Authenticate

include_once $_SERVER['DOCUMENT_ROOT'] . 'hostelManagement/config.php';
if ($_SERVER["REQUEST_METHOD"] != 'POST') {
    include_once ROOT_DIR . "view/error/error_top.php";
    echo 'Your connection is NOT SECURE<br>Ensure you are connected safely';
    include_once ROOT_DIR . "view/error/error_bottom.php";
} else {
    $login_type = $_POST["user-type"];
    if ($login_type == "student") {
        include_once ROOT_DIR . "user/student/controller/authenticate.php";
        $loginStudent = new Authenticate();
        $loginStudent->authenticate();
    } else {
        if ($login_type == "owner") {
            include_once ROOT_DIR . "user/owner/controller/authenticate.php";
            $loginOwner = new Authenticate();
            $loginOwner->authenticate();
        } else {
            if ($login_type == "admin") {
                include_once ROOT_DIR . "user/owner/controller/authenticate.php";
                $loginAdmin = new Authenticate();
                $loginAdmin->authenticate();
            } else {
                include_once ROOT_DIR . "view/error/error_top.php";
                echo 'Something went wrong<br>Please Contact us';
                include_once ROOT_DIR . "view/error/error_bottom.php";
            }
        }
    }
}
?>
	
开发者ID:ashishhrt,项目名称:hostelManagement,代码行数:30,代码来源:login_controller.php


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