Important facts about commercial licenses

  • Licenses are perpetual. They do not expire and do not need to be renewed.
  • Licenses can be upgraded. You can upgrade to a more expensive license later paying only the difference in cost.
  • Pay attention to the distribution type - Hosted (sites / servers), binary (applications) or source (includes all the others). Choose according to your needs (more below).
  • All licenses allow commercial use unless otherwise indicated.
  • Read the full license by clicking on the icon.
  • Read more about licenses in our handy license guide.
$14

Basic License

1 site, unlimited servers No source distribution
$24

Application License

Unlimited applications Binary restricted distribution
$49

Developer's License

Unlimited projects Source and binary distribution 6 months support
You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

(1 ratings)

Advanced User Management Class

Advanced User Management Class
Developed by Deren Aygin, Released Jul 30, 2011

Complete set of classes providing advanced User Management and Login system

PHP

Tags: class , client , cms , create user

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.

Back to top

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.

Back to top

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

Back to top

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->session_valid_time = 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->logout_code 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.

View all 1 reviews »

User Reviews

  • Damien Rose 1 month ago
    Very streamlined, easy to integrate, developed with standards and you can tell the developer took their time and wanted to produce the best result. The class removes the need for multiple instances of various other classes and has increased load time significantly.
    Flag
    Was this helpful? Yes No
Read all 10 comments »

Questions & Comments


Or enter your name and Email
  • Deren Aygin Developer 2 months ago
    I have just used v1.10 (latest) version of Advanced User Management Class in another project and it's still working great. How is AUMC working for you? Have any suggestions or bugs to report? Let us know.
  • Alex Davies License holderBasic License 12 months ago
    Does this Class support user permissions? So for example; User 1 will be able to see more features than User 2?
    • Deren Aygin Developer 12 months 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 {
      //....
      }
    • Alex Davies License holderBasic License 12 months ago
      Great, that's me sold. Anything interesting in the pipeline for this plugin?
    • Deren Aygin Developer 12 months 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.
  • Deren Aygin Developer 12 months ago
    June 2012:
    Update v1.10 has been released:
    - Added Email Activation and Validation
    - Added Demonstrations of features
    - Added QuickStart guide
    - Added Database Connection class
    - Improved Edit method of User Class
You must be logged-in to vote. Log-in to your account or register now.