Pairs up username and password as registrered in the database.
If the username and password is correct, it will return (int)user id of
the user which credentials has been passed and set the session, for
use by the user validating.
SimpleUsers::setInfo( string $key, string $value [, int $userId] )
Sets a custom information pair, consisting of a key name and that keys value for a user.
Setting the third parameter sets the provided information for a given user, instead of the one calling it.
SimpleUsers::getInfo( string $key [, int $userId] )
Use this function to retrieve stored custom user information.
Setting the third parameter gets the stored information for a given user, instead of the one calling it.
SimpleUsers::getInfoArray( [int $userId] )
Returns an associative array with all the custom information stored about the current user.
Passing a userId as a parameter will return an associative array with all the custom information for that specific user.
SimpleUsers::logoutUser()
Logout the active user, unsetting the users session.
SimpleUsers::setPassword( string $password [, int $userId] )
Update the users password with this function.
It generates a new salt and a sets the users password provided by the first parameter.
Providing a userId in the second paramater will set the password for that specific user.
SimpleUsers::getUsers()
Gives you an array with all registered users and their basic information (last activity, creation date, username and userId)
SimpleUsers::getSingleUser( [int $userId] )
Gives you an associative array, containing the basic information (last activity, creation date, username and userId) for the current active user.
If a userId is provided as parameter, the returned associative array will contain the basic information for that specific user.
SimpleUsers::deleteUser( int $userId )
Deletes a given user and stored custom information with it.
SimpleUsers::getToken( [bool] )
Returns a hidden input field with a unique token value for CSRF to be used with post data.
The token is saved in a session for later validation.
The boolean parameter is default set to true which returns the input field as XHTML - provide (bool) false for HTML 4 compliance.
SimpleUsers::validateToken()
Use this method when you wish to validate the CSRF token from your post data.
The method returns true upon validation, otherwise false.
Members
SimpleUsers::logged_in
This tells wether a user is logged in or not.
Value is (bool)true or (bool)false.
SimpleUsers::userdata
This is auto-populated array containing the information stored for the logged in user.
If no user is logged in, this member consists of an empty array.