Personal License $13.99

1 site, unlimited servers No source distribution Commercial use allowed Can modify source Read full license

Developer License $30.99

Unlimited projects Source and binary distribution Commercial use allowed Distribute modifications Read full license

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.

Starting from $ 13.99

View Pricing 14 days money-back guarantee
(1 ratings)

User Class

Complete User Management and Authentication php class

Description

User Management and Authentication is very versatile php class php class that covers every aspect of user management you might need.

It uses MySQL5+ (pdo) as database backend, no fixed database structure is needed you can easily adapt it to your current table structure. In initial db table field setup (simple array), you can set validation, pass-through function (md5 for password for example or phone formatting function), plus all options needed to define table.

Validation is built-in, supports: uniqueness and one of checks, regular expressions, required and external function calls.

After you finish initial setup will automatically suggest table structure if no table is present.

Back to top

Documentation and Examples

Using class is very simple. Here are few examples:

Register new user

$user = new User();
$user->username = 'john.doe';
$user->password = 'samplepassword';
$user->email = 'example@ferdinand.rs';
$user->firstname = 'John'; //optional
$user->lastname = 'Doe'; //optional
//$user->status = 'NEW'; //NEW is set as default value, can be changed
$user->date_joined = date('Y-m-d H:i:s', time());
//$user->validate(); //validate will be called on save, but you can manually call it also
$user->save();

/* prints validation errors */
print_r($user->validationErrors);

Update user data

Update user is same as insert/register, just pass userid of user

$user = new User($userid);
/* all fields are optional, just set what you want to update */
$user->username = 'john.doe';
$user->password = 'samplepassword';
$user->email = 'example@ferdinand.rs';
$user->firstname = 'John'; //optional
$user->lastname = 'Doe'; //optional
//$user->status = 'NEW'; //NEW is set as default value, can be changed
$user->date_joined = date('Y-m-d H:i:s', time());
//$user->validate(); //validate will be called on save, but you can manually call it also
$user->save();

Load user

$user = new User();
//load by -- anything
$res = $user->loadby('username', 'john');
//or
$res = $user->loadby('firstname', 'John');
print_r($res);
//or by id
$user = new User($userid);
//or
$user->load($userid);

Delete user

$user = new User($userid);
$user->delete();

Login

$user = new User($userid);
/* username, password and number of days to remember user, zero for don't remember */
if ($user->login($username, $password, 7))
     print "success";
else
     print "fail";

Logout

$user = new User();
$user->logout();

Is user authenticated

$user = new User();
if ($user->isLoggedIn())
    print "yes";
else
    print "no";

Search

$user = new User();
$res = $user->search('jo*hn'); // * acts as a wild card, wildcards are automatically added to     begining and end of string
//$user->search('jo*n', array('username')); //if you wish to search just by username, other field names can be added
/* prints results */
print_r($res);
Back to top

Requirements

  • PHP5+, with pdo_mysql
  • MySQL5+
Read all 1 comments »

Questions & Comments

  • Jason Becht License holder said:

    5 months ago
    At first glance the code seems well thought out and concise, however, this is NOT the case.

    upon attempting to install and configure, the script was able to create a user and add them to the DB. This user however, would not be able to log in as the code in the script required for this process was filled with errors. The developer obviously NEVER tested this version before release, if he had done so it would have definitely failed and he would have corrected the issue.

    As it stands now, I bought the full license (with the ability to distribute/sell derivative works). I have already fixed the code to function for registration and login, and will be updating to include passing session variables. The new and fully functional class will be available when I have completed it and you will be able to find it at: rwsdev.net.

    advice: DO NOT BUY THIS BROKEN SOFTWARE!

Leave a comment

You must be logged-in to leave a comment.
Log-in now or register for a free account.
You must be logged-in to vote. Log-in to your account or register now.
View all 1 reviews »

User Reviews

    *** EDIT *** 1.31.2012 - The developer has stated that he has included one of my fixes and that he has reworked the code. If this has been done I believe this Class could be a very useful purchase.

    The review below was my original review before the developer fixed the issues that caused that review.

    *** OLD ***
    At first glance the code seems well thought out and concise, however, this is NOT the case.

    upon attempting to install and configure, the script was able to create a user and add them to the DB. This user however, would not be able to log in as the code in the script required for this process was filled with errors. The developer obviously NEVER tested this version before release, if he had done so it would have definitely failed and he would have corrected the issue.

    As it stands now, I bought the full license (with the ability to distribute/sell derivative works). I have already fixed the code to function for registration and login, and will be updating to include passing session variables. The new and fully functional class will be available when I have completed it and you will be able to find it at: rwsdev.net.

    advice: DO NOT BUY THIS BROKEN SOFTWARE!
    - Jason Becht, 5 months ago
    Flag review
    Was this helpful? Yes No

Starting from $ 13.99

View Pricing 14 days money-back guarantee