User Class

Released 7 years ago , Last update 6 years ago

Complete User Management and Authentication php class

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.

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

Pricing

14 day 14-day money-back guarantee

$13.99

Personal License

  • Perpetual license

  • 1 site, unlimited servers

  • No distribution (hosted use only)

  • Commercial use

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);

Requirements

  • PHP5+, with pdo_mysql
  • MySQL5+
2 licenses, starting from From » $13.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
No comments have been posted yet.