當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authentication::authenticate方法代碼示例

本文整理匯總了PHP中Authentication::authenticate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authentication::authenticate方法的具體用法?PHP Authentication::authenticate怎麽用?PHP Authentication::authenticate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Authentication的用法示例。


在下文中一共展示了Authentication::authenticate方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _run

 protected function _run($request)
 {
     if ($this->requestMethod == 'POST' && count($request) == 0) {
         // User tries to login
         Authentication::login($_POST['username'], $_POST['password']);
         if (!Authentication::authenticated()) {
             Headers::sendStatusUnauthorized();
             return;
         } else {
             Headers::sendStatusOk();
             echo "login succeeded<br>";
             return;
         }
     } else {
         Authentication::authenticate();
         if (!Authentication::authenticated()) {
             Headers::sendStatusUnauthorized();
             return;
         }
         if ($this->requestMethod == 'GET' && count($request) > 0) {
             // User info requested
             echo "requesting userinfo of user " . $request[0];
         } else {
             // Bad request
             Headers::sendStatusMethodNotAllowed();
             echo "Method not allowed<br>";
             print_r($request);
         }
     }
 }
開發者ID:tuksik,項目名稱:zarafa-rest-api,代碼行數:30,代碼來源:class.UsersResourceController.php

示例2: __construct

 public function __construct($request)
 {
     $this->_setRequestMethod();
     Authentication::authenticate();
     if (!Authentication::authenticated()) {
         // Return unauthorised response
         Headers::sendStatusUnauthorised();
         echo "Unauthorised<br>";
         return;
     }
     $this->_run($request);
 }
開發者ID:tuksik,項目名稱:zarafa-rest-api,代碼行數:12,代碼來源:class.ResourceController.php

示例3: authenticate

 protected function authenticate()
 {
     $auth = new Authentication();
     if (($user = $auth->authenticate($_POST['Login']['Username'], hash('sha512', $_POST['Login']['Password']))) !== false) {
         if (!isset($_SESSION['Authenticated'])) {
             $_SESSION['Authentication'] = array();
         }
         $_SESSION['Authentication']['User'] = $user;
         $_SESSION['Authentication']['LoggedIn'] = true;
     } else {
         $GLOBALS['Smarty']->assign('errormessage', 'Login fehlgeschlagen');
     }
 }
開發者ID:OdysseyDE,項目名稱:omer_team_registration,代碼行數:13,代碼來源:AuthenticatedCommand.php

示例4: loginSubmit

 public function loginSubmit($credentials = [])
 {
     if (isset($credentials)) {
         if ($credentials['userid'] != '') {
             if ($credentials['password'] != '') {
                 if (Authentication::authenticate($credentials)) {
                     $_SESSION['userid'] = $credentials['userid'];
                     $_SESSION['isLogin'] = true;
                     header("Location: ../welcome/");
                 } else {
                     $this->flushOutput('Login failed.');
                 }
             } else {
                 $this->flushOutput('Please fill Password.');
             }
         } else {
             $this->flushOutput('Please fill ID No.');
         }
     }
 }
開發者ID:vincentnacar02,項目名稱:beans-php,代碼行數:20,代碼來源:LoginController.php

示例5: dirname

 *
 * The second part of the query is provided by AJAX in the form of the -query- variable, containing
 * whatever terms the user enters in the autocomplete field.
 */
/**
 * allow for testing
 */
$debug = false;
/**
 * includes
 */
require_once dirname(dirname(dirname(__FILE__))) . "/redcap_connect.php";
/**
 * restricted use
 */
$userAuthenticated = Authentication::authenticate();
if ($userAuthenticated) {
    /**
     * get text entered by user. This is appended to query string by jquery autocomplete
     */
    $full_query = $_GET['q'];
    $term = prep($_GET['term']);
    /**
     * get field name, used to make session unique
     */
    $field_name = $_GET['f'];
    $query_field = $_GET['a'];
    /**
     * get query fragment, passed in session variable to keep prying eyes away
     * results should be limited by adding LIMIT 0,n to query after $term enclosure
     * if no session variable, return an appropriate error value
開發者ID:hcv-target,項目名稱:redcap_plugins,代碼行數:31,代碼來源:autocomplete_control_ajax.php


注:本文中的Authentication::authenticate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。