Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Security API > Methods

Security API: checkUsernamePassword

Scroll Prev Next More

 

This function checks username and password and returns true if the username/password are correct, returns false otherwise.

 

If username/password are incorrect and $fireEvents is set to true, PHPRunner runs the AfterUnsuccessfulLogin event.

 

This function doesn't perform the authorization, just validates the username and password.

Syntax

Security::checkUsernamePassword($username, $password, $fireEvents = false)

Arguments

$username

the username.

$password

the user's password.

$fireEvents = false

If username/password are incorrect and $fireEvents is set to true, PHPRunner runs the AfterUnsuccessfulLogin event.

Return value

true

if username/password are correct.

false

if username/password are not correct.

Example

This example shows how to output the current user data:

 

var_dump (Security::checkUsernamePassword($username, $password, $fireEvents = false));

Sample output

bool(false)
or
bool(true)

See also:

Event: After Unsuccessful Login

Event: BeforeLogin

Security screen: Security settings

About Security API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software