PHPBuilder - Foundations of Pear: Authentication Page 2

RSS Twitter
Articles Pear

Foundations of Pear: Authentication - Page 2

by: PHP Builder Staff
January 25, 2007

Returns true if there is a session with valid authentication. boolean checkAuth()

Returns true if the current user is logged in. boolean getAuth()
Returns the authentication data for the given field. If nothing is passed to the function, it will return everything that it knows about the current session.
mixed getAuthData([string $name = null])
Parameter Type Description
$name string The name of the field that contains the authentication data.
Returns the name of the field used for the password.
string getPostPasswordField()
Returns the name of the field used for the username.
string getPostUsernameField()

Returns the status of the current user.

string getStatus()

Returns the name of the current user.

string getUsername()

Returns an array containing the names of all the users in the current storage container.

array listUsers()

First calls the logout callback method, if one is defined, then sets the username and password to empty strings and sets the session to null.

void logout()

Deletes the given user from the storage container and returns true if the function is successful. If the user wasn’t deleted, the function returns AUTH_METHOD_NOT_SUPPORTED.

mixed removeUser(string $username)

Parameter Type Description

$username string The login name of the user to be removed.

Returns the time in seconds until the session expires.

integer sessionValidThru()

If passed true, Auth begins to perform more advanced security checks, such as detecting IP address and user agent changes.

void setAdvancedSecurity([boolean $flag = true])

Join us next week as we continue this chapter on authentication!
This article is an excerpt from Chapter 2 of Foundations of Pear, reprinted with permission from Apress.

Comment and Contribute

Your comment has been submitted and is pending approval.




(Maximum characters: 1200). You have characters left.