Advanced User Management Class

Advanced User Management Class

Released 7 years ago , Last update 6 years ago

Complete set of classes providing advanced User Management and Login system

The package includes a fully integratable, dynamic, advanced user management system. It doesn't require a fixed database structure and has complete expandability to fit your needs.

The system allows easy creation of users and a powerful, simple search method to accomodate all your needs. The edit ability is elegant and simplistic. All passwords are encrypted using a salt method unique to each individual user. A complete login system handles all logins and logouts securely. Optional email activation for Users.

The documentation below gives a comprehensive overview of the methods available. All files, classes and methods in the source code are FULLY DOCUMENTED. It's all really simple and examples are provided.

Expandability

The code is designed in such a way that it is very easy to expand upon it and add methods that suit your specific requirements.

Support

The Developer's License comes with 6 months free support to help you install the product should you need it.

Coming Soon

Full administrator control panel to cater for those not wishing to integrate this code into their system but for a user system to run alongside their project.

5.0
  • 5 1
  • 4 0
  • 3 0
  • 2 0
  • 1 0
1 Reviews Read Reviews

Pricing

14 day 14-day money-back guarantee

$24.99

Single Site License

  • Perpetual license

  • 1 site, unlimited servers

  • No distribution (hosted use only)

  • Commercial use

$49.99

Developer License

  • Perpetual license

  • Unlimited projects

  • Can distribute code and binary products

  • Commercial use

  • 6 months support

Simple Installation - No Batteries required!

Complete installation is demonstrated in the QuickStart guide demonstrations/QuickStart.html included in the source code. Estimated installation time of 10 to 15 minutes.

Demonstrations

There is a demonstration for each feature in demonstrations/. The Usage and Documentation below is for you to get an idea of the code pre-purchase.

Snippet of Login/Logout demonstration

alt text

Documentation and Usage

ActivateEmail - Deals with email acivation attempts
EmailActivation - Sending activation email and generating activation codes
ConnectionData - Provides connection information to Login/Logout
DatabaseConnection - Connects to database
Login - Handles all logins
Logout - Handles all logouts
Salter - Handles all salt methods
Sessions - Handles sessions
UMSConfig - This is the main class, most classes extend this.
UMSException - Extends Exception 
UserManagement - Handles all non user-specific functions
User - Handles all user-specific functions

Create User

$array = array( "username" => "Somebody123",
                 "password" => "mypassword123");

$ums = new UserManagement();
$ums->createUser($array);
  • Username and password are the only two compulsory fields.
  • The password will be automatically encrypted, so you don't need to worry yourself with that.
  • If you changed any column headings in UMSConfig then the key here should be the same as your chosen heading.

For the other information you want to store on the user, just ensure the respective column exists in the table and you can use the array in the same way:

$array = array( "username" => "Somebody123",
                 "password" => "mypassword123",
                 "first_name" => "Joe",
                 "last_name" => "Bloggs",
                 "telephone" => "0800 000 0000"
                 "foo" => "bar");

$ums = new UserManagement();
$ums->createUser($array);

Check Username Availability

There is a configuration setting in UMSConfig to automatically double check if the username is available for use. This method is available for you to use too.

$ums = new UserManagement();
$result = $ums->checkUsernameAvailability("username123");

The method will return true if the username is available.

Search

The search method will automatically compile your MYSQL Query. All you need to do is feed it the information

    $ums = new UserManagement();
    $ums->search(
    $array = array(),
    $select = "*",
    $type = "EQUALS",
    $limit = false,
    $order = false,
    $direction = "DESC",
    $offset = false);

- $array is an array of the terms you want to search for in the form column => value. For example, searching for first_name Bill and last_name Bailey:
$array = array("first_name" => "Bill", "last_name" => "Bailey")
- $select is what you want to select, just like you would put in a query
- $type can be "LIKE" or "EQUALS" choosing "LIKE" will automatically wildcard the search terms by putting % either side of it.
- $limit = MYSQL Limit
- $order = column to order by
- $direction= MYSQL Order (ASC, DESC etc)
- $offset = Limit offset

The information returned will be compiled into an array and returned in the method.

User

The User class is specific to a user. This is because the user id is fed to the class when the object is created.

$user = new User(1);

The example uses an ID of 1 as an example, the Sessions class can be used to provide the ID of the user currently logged in. This is shown further down

User information is automatically retrieved from the database. Password is ommitted for security purposes. All database values except password will be accessible in the $user->info object. For example, if you have columns 'first_name' and 'last_name'. Such as:

$user->info->first_name;
$user->info->last_name;

This is automatically compiled and updated when the user info is edited. To retrieve password, use the method getPassword() (in it's encrypted form - see Salters).

$password = $user->getPassword();

Calling the method databasedSessionInformation() will load information about the users current session (if there is one) that stored in the Logins table. Informtion will be in the object $user->login_info->.... The variable name will be the same as the column heading. For example, hostname will be $user->login_info->hostname. Other information includes ip and session_id.

Edit User

$user = new User(1);
$user->edit(array("username" => "superman"));
  • Array key represents the column name and the value represents the new value
  • Passwords will be automatically encrypted (just like they were in creation)

Sessions

The session time limit can be set in UMSConfig $this->sessionvalidtime = 3600;

Sessions past the inactivity time limit will be expired and User ID is automatically checked against initial connection data to avoid session hijacking. Session expire time can be extended using updateExpire($user_id).

Usage

Throwing the above together, you can form a snippet something like this:

$session = new Sessions();
if ($session->check == true) {//User is logged in
$user = new User($_SESSION['user_id']);
$session->updateExpire($user->user_id);
}

The session class has thoroughly checked that the $_SESSION['user_id'] value is valid, permitted and has not been hijacked. Putting this at the top of all pages that require login will create object $user for the user logged in. You can add an else { } clause for an action if the user isn't logged in.

Login

$login = new Login("myusername","mypassword");

The login class requires username and password in the constructor. You can take both of these from the login form $_POST values.

if($login->result == true) {
     //login was successful...

Everything is automated. The session will automatically be created and a reference will be stored in the logins table.

Logout

A logout code was generated when the login initiated. This is accessible from the user class:

$user = new User($_SESSION['user_id']);
    print $user->logout_code;

You can put the $user->logoutcode into a $GET link on your logout page. It can then be validated as follows:

$logout = new Logout($user->user_id,$_GET['logout_code']);

if ($logout->check() == true) {
   //logout was successful...

The session is automatically destroyed, there is nothing more you need to do. Logout code aesthetics is completely customisable in UMSConfig.

Salters

All encryption is automatic, there is no need for you to manually encrypt anything. If you wish to do so the Salters class is clearly documented.

Putting it all together

Put this at the top of your initial includes file.

session_start();
$session = new Sessions();

if ($session->check == true) {//User is logged in
$user = new User($_SESSION['user_id']);
$session->updateExpire($user->user_id);
}

The $user class is created if the user is logged in and you can use it in the rest of the page.

When you want to enter UserManagement, just initiate the class.

$ums = new UserManagement();

Error Handling

You can choose if mysql_errors() are thrown via configurations settings in UMSConfig. If you set $throw_errors, they will still be accessible via getErrors(). This can be called from any class that extends UMSConfig. Exceptions are thrown by UMSException.

Advanced configuration

UMSConfig contains lots of extra debugging, error and security configuration. The code is well documented according to PHP standards.

3 licenses, starting from From » $24.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
  • AD Alex Davies License holderBasic License
    Purchased on Jun 9, 2012
    6 years ago
    Does this Class support user permissions? So for example; User 1 will be able to see more features than User 2?
    • Deren Aygin Publisher 6 years ago
      Yes. Add a column such as 'access_level' to the Users table. The value of that column can then be attained by $user->info->access_level You can then use the value to set the appropriate action. IE if ($user->info->access_level < 2) { echo 'You do not have sufficient privelages...'; } else { //.... }
    • AD Alex Davies 6 years ago
      Great, that's me sold. Anything interesting in the pipeline for this plugin?
    • Deren Aygin Publisher 6 years ago
      Glad you like it Alex, thank you. As it stands this class is backend, I plan to expand and add an admin panel into it. Whilst the PHP for it is easy enough, I'm just working on a few designs before I commit to it. Your comment made me realise I could probably build the access level system into the core structure and add a function to restrict pages and display default error pages if access level is too low. It's now written on the notepad for the next release. Please let me know if you need any more assistance.
  • KN Kjell Arne Neshagen 6 years ago
    Looks like this is the class i need for my new project. I have one question though.. Does it handle e-mail activation ? If not, how big a job would it be to add such a function to it ?
    • Deren Aygin Publisher 6 years ago
      Hi Kjell, I orginally planned to add email activation but didn't have the time to implement it. I believe it will be a great addition to the package and will add it into the package within the next week or so and upload the release which will be available to all clients, including those who have already purchased the package. Please feel free to comment with any more queries you may have. Deren EDIT: This is definitely going ahead, I've written the code and am in the testing phase. I'm also taking this opportunity to revamp some other features
    • Deren Aygin Publisher 6 years ago
      This feature has now been added to the source code. Hope you enjoy.