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


PHP Auth::getUsername方法代码示例

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


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

示例1: accessLevelForPath

function accessLevelForPath($path)
{
    global $config;
    if (!is_dir($config['files'] . $path)) {
        return 2;
    }
    if (!is_file($config['files'] . $path . '/.acl.json')) {
        return 2;
    }
    $acl = file_get_contents($config['files'] . $path . '/.acl.json');
    $acl = json_decode($acl, true);
    // If can't parse ACL, fail just in case.
    if (!$acl) {
        return 0;
    }
    // Username, or empty string if not logged in.
    $username = Auth::getUsername();
    // Note: having write permission implies read permission.
    if (isset($acl['write']) && accessMatch($username, $acl['write'])) {
        return 2;
    }
    if (isset($acl['read']) && accessMatch($username, $acl['read'])) {
        return 1;
    }
    return 0;
}
开发者ID:Dirbaio,项目名称:TurboFile,代码行数:26,代码来源:lib.php

示例2: getCurrentUserId

 /**
  * Return current user id based on session or cookie
  *
  * @return mixed Integer user id or boolean false when user
  *               could not be found or is not logged on.
  */
 public function getCurrentUserId()
 {
     if (!$this->auth) {
         return parent::getCurrentUserId();
     }
     //FIXME: caching?
     $name = $this->auth->getUsername();
     if (!$name) {
         return parent::getCurrentUserId();
     }
     return $this->getIdFromUser($name);
 }
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:18,代码来源:AuthUser.php

示例3: readUserData

 /**
  * Starts and verifies the PEAR::Auth login process
  *
  * @return boolean true upon success or false on failure
  *
  * @access private
  */
 function readUserData()
 {
     $this->pearAuth->start();
     // If a user was found, read data into class variables and set
     // return value to true
     if (!$this->pearAuth->getAuth()) {
         return null;
     }
     $this->propertyValues['handle'] = $this->pearAuth->getUsername();
     $this->propertyValues['passwd'] = $this->encryptPW($this->pearAuth->password);
     $this->propertyValues['is_active'] = true;
     $this->propertyValues['auth_user_id'] = $this->pearAuth->getUsername();
     $this->propertyValues['lastlogin'] = '';
     return true;
 }
开发者ID:Zunair,项目名称:xataface,代码行数:22,代码来源:PEARAuth.php

示例4: readUserData

 /**
  * Reads user data from the given data source
  * Starts and verifies the PEAR::Auth login process
  *
  * @param  string user handle
  * @param  string user password
  * @param  bool|int if the user data should be read using the auth user id
  * @return bool true on success or false on failure
  *
  * @access public
  */
 function readUserData($handle = '', $passwd = '', $auth_user_id = false)
 {
     $this->pearAuth->username = $auth_user_id !== false ? $auth_user_id : $handle;
     $this->pearAuth->password = $passwd;
     $this->pearAuth->start();
     if (!$this->pearAuth->getAuth()) {
         return null;
     }
     // User was found, read data into class variables and set return value to true
     $this->propertyValues['auth_user_id'] = $this->pearAuth->getUsername();
     $this->propertyValues['handle'] = $this->pearAuth->getUsername();
     $this->propertyValues['passwd'] = $this->encryptPW($this->pearAuth->password);
     if (!array_key_exists('is_active', $this->tables['users']['fields'])) {
         $this->propertyValues['is_active'] = true;
     }
     if (!array_key_exists('lastlogin', $this->tables['users']['fields'])) {
         $this->propertyValues['lastlogin'] = null;
     }
     return true;
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:31,代码来源:PEARAuth.php

示例5: mensajeLogout

    echo '<form method="post" action="pruebaLogin.php">';
    echo '<input type="submit" name="botonCerrarSesion" value="Cerrar sesión">';
    echo '</form>';
}
function mensajeLogout()
{
    echo '<h1>Ha cerrado sesión</h1>';
}
function mensajeLoginExitoso()
{
    echo '<h1>Ha iniciado sesión</h1>';
}
function mensajeLoginFallido()
{
    echo '<h1>No se pudo iniciar sesión</h1>';
}
$options = array("dsn" => "mysql://root:labsis@localhost/controlacceso", "table" => "usuario", "usernamecol" => "numeroDocumento", "passwordcol" => "password", "cryptType" => "sha1");
$autenticacion = new Auth("MDB2", $options, "formularioLogin");
$autenticacion->setLogoutCallback("mensajeLogout");
$autenticacion->setLoginCallback("mensajeLoginExitoso");
$autenticacion->setFailedLoginCallback("mensajeLoginFallido");
$autenticacion->start();
if ($autenticacion->checkAuth()) {
    if (isset($_POST['botonCerrarSesion'])) {
        $autenticacion->logout();
        $autenticacion->start();
    } else {
        echo '<p>Logueado como: ' . $autenticacion->getUsername() . '</p>';
        formularioLogout();
    }
}
开发者ID:jorgeeliecerballesteros,项目名称:controldeacceso,代码行数:31,代码来源:pruebaLogin.php

示例6:

<!-- Produced By Ron Royston, ron@stndip.com -->
<html lang="en">
  <body class="">
    <!-- Uses a header that scrolls with the text, rather than staying locked at the top -->
    <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
      <header class="mdl-layout__header mdl-layout__header--scroll mdl-color--white mdl-color--grey-600 ">
        <div class="mdl-layout__header-row">
          <!-- Title -->
          <span class="mdl-layout-title font1 xl">rack!</span>
          <!-- Add spacer, to align navigation to the right -->
          <div class="mdl-layout-spacer"></div>
          <!-- Navigation -->
          <nav class="mdl-navigation">
            <?php 
if ($a->getAuth()) {
    echo "<a class=\"mdl-navigation__link\" href=\"profile\">" . $a->getUsername() . "</a>";
    echo '<a class="mdl-navigation__link" href="includes/logout">logout</a>';
} else {
    echo '<a class="mdl-navigation__link" href="access">Login &#47; Register</a>';
}
?>
            <div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable">
              <label class="mdl-button mdl-js-button mdl-button--icon" for="search">
                <i class="material-icons">search</i>
              </label>
              <div class="mdl-textfield__expandable-holder">
                <input class="mdl-textfield__input" type="text" id="search" />
                <label class="mdl-textfield__label" for="search">Enter your query...</label>
              </div>
            </div>
          </nav>
开发者ID:rhroyston,项目名称:app1,代码行数:31,代码来源:index.php

示例7: isAllowed

 public function isAllowed(Auth $auth)
 {
     return $auth != null && in_array($auth->getUsername(), $this->whitelist);
 }
开发者ID:jungepiraten,项目名称:nntpboard,代码行数:4,代码来源:whitelist.class.php

示例8: array

     */
    echo "<form method=\"post\" action=\"{$PHP_SELF}\">";
    echo "<input type=\"text\" name=\"username\">";
    echo "<input type=\"password\" name=\"password\">";
    echo "<input type=\"submit\">";
    echo "</form>";
}
$dsn = "mysql://cityg_8:gBhpj4Xj@db72c.pair.com/cityg_dev";
$params = array("dsn" => $dsn, "table" => "users", "usernamecol" => "username", "passwordcol" => "password");
$a = new Auth("DB", $params, "loginFunction");
print "Breakpoint 4";
$a->setSessionname('SPU_SITE');
$a->setExpire(3600);
// 60mins in seconds
$a->start();
$username = $a->getUsername();
print "Username: {$username}";
//log_err( __FILE__, __LINE__, "Status: ". $a->getStatus());
print "Status: " . $a->getStatus();
/**
Report:
THIS IS ALL WRONG: I was setting optional to 1 or 0 not true or false.
The docs are not very clear about the behavoir of Auth under all options and conditions.
With no callback defined: GET request with optional at zero produced default internal login form. With optional at one, produced the same.
With a dummy callback defined: GET request value of zero for optional displayed the callback login. A value of one did the same.
LOGGEDIN	GET		callback	optional	result
N			Y		N			0			internal form
N			Y		N			1			internal form
N			Y		Y			0			callback form
N			Y		Y			1			callback form
The form action for the internal form is (wisely) set to PHP_SELF.
开发者ID:steveknoblock,项目名称:OomochaFramework,代码行数:31,代码来源:test2.php

示例9: Auth

     // password required
     require "auth.php";
     $auth = new Auth();
     if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
         $auth->prompt();
         $digest = $_SERVER['PHP_AUTH_DIGEST'];
         $verified = $auth->verifyUser($digest);
     } else {
         $digest = $_SERVER['PHP_AUTH_DIGEST'];
         $verified = $auth->verifyUser($digest);
         if ($verified == 0) {
             $auth->prompt();
             $digest = $_SERVER['PHP_AUTH_DIGEST'];
             $verified = $auth->verifyUser($digest);
         }
         $memberUsername = $auth->getUsername($digest);
     }
     if ($verified == 1) {
         // valid password, look up authorization list
         $member = $auth->verifyMembership($username, $memberUsername);
         if ($member == 1) {
             $viewer->loadUserPage($username);
         } else {
             $viewer->unauthorized($username);
         }
     }
 } else {
     if ($username != "") {
         $viewer->loadUserPage($username);
     } else {
         $viewer->loadAllPage(1);
开发者ID:laiello,项目名称:yapastream,代码行数:31,代码来源:index.php

示例10: htmlspecialchars

<!DOCTYPE html>
<html ng-app="TurboFileApp" ng-controller="TurboFileCtrl">
<head>
	<base href="/">
	<title>{{$location.path()}}</title>
	<link rel="stylesheet" type="text/css" href="/_turbofile/css/app.css">
	<link rel="stylesheet" type="text/css" href="/_turbofile/css/theme2.css">
	<link rel="stylesheet" type="text/css" href="/_turbofile/css/animations.css">
</head>
<body ng-class="{animate: animate}">
	<div class="header_bar">
		<div id="user">
<?php 
$username = Auth::getUsername();
if ($username == '') {
    echo '<a reload="true" href="' . htmlspecialchars(Auth::getLoginUrl()) . '">Log in</a>';
} else {
    echo 'Hello, ' . htmlspecialchars($username) . '! <a reload="true" href="' . htmlspecialchars(Auth::getLogoutUrl()) . '">Log out</a>';
}
?>
		</div>
		<div id="logo"></div>
	</div>
	<div class="panels">
		<div class="panel"
		     ng-repeat="panel in panels"
		     ng-class="{
			     	hasnext: !$last,
			     	panel_dir: panel.type=='dir',
			     	panel_file: panel.type=='file',
			     }">
开发者ID:Dirbaio,项目名称:TurboFile,代码行数:31,代码来源:page.php

示例11: 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

示例12: getUsername

 /**
  * PEAR::Auth側のusernameを返す
  *
  * @return string
  */
 function getUsername()
 {
     return $this->auth->getUsername();
 }
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:9,代码来源:Auth.php

示例13: loginFunction

function loginFunction()
{
}
$dsn = "mysql://cityg_8:gBhpj4Xj@db72c.pair.com/cityg_dev";
$params = array("dsn" => $dsn, "table" => "users", "usernamecol" => "username", "passwordcol" => "password");
$a = new Auth("DB", $params, "loginFunction", FALSE);
// need to add member var for auth
$c->auth = $a;
//print "Auth: ".$c->auth;
// this does not seem to be working
//$c->auth->setSessionname('AUTHUSER');
//$a->setSessionname('AUTHUSER');
$a->setExpire(3600);
// 60mins in seconds
$a->start();
$username = $a->getUsername();
//print "<p>Username: $username</p>";
//log_err( __FILE__, __LINE__, "Status: ". $a->getStatus());
//print "Status: ". $a->getStatus();
// assign dynamic data
// All modules on the site could benefit from having
// the name of the currently logged in user. This needs
// to be displayed on nearly every page in an application.
// this depends on auth module, should auth method name
// change, this must be changed, be nice to have a wrapper
// object around auth
// yep, fails, context is not available here
//$this->assign('AUTH_USER_NAME', $this->c->auth-getUsername());
define('AUTH_USER_NAME', $a->getUsername());
/**
 * Helper classes.
开发者ID:steveknoblock,项目名称:OomochaFramework,代码行数:31,代码来源:index.php

示例14: Auth

<?php

require_once "Auth.php";
require_once "config.php";
$a = new Auth("DB", CONN_DSN);
$a->start();
if (!$a->checkAuth()) {
    exit;
}
if ($a->getUsername() == ADMIN_LOGIN) {
    include "tpls/AdminPage.php";
} else {
    include "tpls/UserPage.php";
}
开发者ID:rivetweb,项目名称:old-auto-catalog,代码行数:14,代码来源:Main.php

示例15: loginFunction

$a = new Auth("DB", $options, "loginFunction", $optional);
$a->start();
function loginFunction()
{
    // show login page
}
function loginSuccess($username, $a)
{
    // write successful login to log
}
function loginFailed($username, $a)
{
    // write failed login to log
}
if ($a->getAuth()) {
    $email = $a->getUsername();
    $firstname = $a->getAuthData('firstname');
    $lastname = $a->getAuthData('lastname');
    $street = $a->getAuthData('street');
    $city = $a->getAuthData('city');
    $state = $a->getAuthData('state');
    $zip = $a->getAuthData('zip');
    $birthday = $a->getAuthData('birthday');
    $phone = $a->getAuthData('phone');
}
include 'includes/head.php';
?>
<!-- Produced By Ron Royston, ron@stndip.com -->

<html lang="en">
  <body>
开发者ID:rhroyston,项目名称:app1,代码行数:31,代码来源:profile.php


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