AuthenticationDatabaseTiein: ezcAuthenticationDatabaseFilter
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcAuthenticationDatabaseFilter
|
Filter to authenticate against a database. [
source]
The database instance to use is specified using a ezcAuthenticationDatabaseInfo structure. Table name and field names are specified in the same structure.
Example:
1. $credentials = new ezcAuthenticationPasswordCredentials( 'jan.modaal', 'b1b3773a05c0ed0176787a4f1574ff0075f7521e' );
2. $database = new ezcAuthenticationDatabaseInfo( ezcDbInstance::get(), 'users', array( 'user', 'password' ) );
3. $authentication = new ezcAuthentication( $credentials );
4. $authentication->addFilter( new ezcAuthenticationDatabaseFilter( $database ) );
5. if ( !$authentication->run() )
6. {
7. // authentication did not succeed, so inform the user
8. $status = $authentication->getStatus();
9. $err = array(
10. 'ezcAuthenticationDatabaseFilter' => array(
11. ezcAuthenticationDatabaseFilter::STATUS_USERNAME_INCORRECT => 'Incorrect username',
12. ezcAuthenticationDatabaseFilter::STATUS_PASSWORD_INCORRECT => 'Incorrect password'
13. )
14. );
15. foreach ( $status as $line )
16. {
17. list( $key, $value ) = each( $line );
18. echo $err[$key][$value] . "\n";
19. }
20. }
21. else
22. {
23. // authentication succeeded, so allow the user to see his content
24. }
Parents
ezcAuthenticationFilter
|
--ezcAuthenticationDatabaseFilter
Constants
Inherited Constants
From
ezcAuthenticationFilter:
Properties
Inherited Member Variables
From
ezcAuthenticationFilter:
Method Summary
|
public ezcAuthenticationDatabaseFilter |
__construct(
$database, [$options = null] )
Creates a new object of this class. |
|
public int |
run(
$credentials )
Runs the filter and returns a status code when finished. |
Inherited Methods
From
ezcAuthenticationFilter :
Methods
__construct
Creates a new object of this class.
Parameters
run
Runs the filter and returns a status code when finished.
Parameters
Redefinition of
Last updated: Thu, 01 Nov 2007