Basic Info | Database | Display | Forms | Monju | Session | Users

user_login

user_login($identifier, $password)

Description

user_login authenticates a user against the database and create an active session for them if none exists, add authentication data to session if one does exist.

Parameters

$identifier: The users identifier. [type:string]

$password: The users password. [type:string]

Return Values

On Success: True [type:boolean] On Failure: False [type:boolean]

Notes

Regenerates the session id. User data added to $_SESSION['user'][%...%]

Examples

// prepare the data $preData = form_prepare('POST', 'DATABASE', $rules); // create the user if(user_login($preData[':identifier'], $preData[':password'])) { echo 'Authenticated!'; } else { echo 'Error authenticating.'; }

Dependencies

- monju.lib.php
- session.lib.php

Comments

Support the Docs!

If you notice a mistake in the documentation, instead file a bug report in the issue tracker. Instead use this to add tips and tricks associated with the functions. You can use tags like to keep your comments clear.