Skip to content

Lissy93/usermonkey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍌 User Monkey

A complete user-management system for PHP apps

Warning This repository is no longer maintained!
For more info, see Project Update and Alternatives ↓

Contents

About

User Monkey is a plug-and-play complete user-management system written in PHP and bundled into a single file. It enables you to easily add support for features where user sign up is required, such as posts/ comments, paywalled content, saving preferences, spam reduction, etc. All the commonly required features are included as standard and there's also an optional UI.

Features

  • Registration
  • Log in / Log out
  • Account Deletion
  • Password Resets
  • Account Verification
  • Editing Account Info
  • Link Social Media Accounts
  • Gravatar Picture Support

There's also an optional UI, which includes the screens for all the above opperations (registration, authentication, profile page, account settings, etc)

Demo

A live demo of the running project can be viewed at: code.as93.net/user-monkey (demo no longer available)

Project Update

This app was developed in 2010-12, and used across several of my apps, and other peoples projects for almost 10 years after. It served it's purpose as a simple single-file user-management system, but times have moved on, and there are now some much better alternatives out there. I strongly recommend against using this project in any production application.

Alternatives

If your looking for a PHP-based user management system, I'd recomend either UserFrosting or UserSpice. Both are widley used, fully tested, clearly documented and serve their purpose well.


Usage

Getting Started

/* First start a session, if not already started */
if(session_id() == '') { session_start(); } 

/* Next include the PHP classes (see demo folder for Db class)*/
include_once $_SERVER['DOCUMENT_ROOT']."/user-monkey/php/Db.class.php";         // Database Class
include_once $_SERVER['DOCUMENT_ROOT']."/user-monkey/php/UserActions.class.php";// User Actions Class

/* Connect to the database */
$db = new Db();
$db->connect();

/* Create an instance of the UserActions class */
$ua = new UserActions();

Register New User

$register = new Register(); 
$success = $register->registerUser($username,$email,$password,"standard"); 

Log In User

$logIn = new Login();
$success = $logIn->start($username, $password);

Log Out

$ua = new UserActions();
$ua->logOut();

Reset Password

$settings = new UserActions();
$success = $settings->resetPassword($userId, $password);

Change Users Email Address

$settings = new UserSettings();
$success = $settings->changeEmail($userId, $password,  $email);

Change Users Password

$settings = new UserSettings();
$success = $settings->changeUsername($userId, $password,  $username);

Delete Users Account

$settings = new UserSettings();
$success = $settings->deleteAccount($userId, $password);

Send Activation Email

$activationObject = new VerifyAccount($userId);
$activationObject->setUrl("http://example.com");
$activationObject->sendActivationEmail();

Verify Users Account

$act = new VerifyAccount($userId);
$success = $act->attemptActivate($code);

If $success is false, then the $object->getMessage(); method can be called that will return a short string informing why the action could not be completed (e.g. "Unable to create account - username already taken"). For example:

$register = new Register(); 
$success = $register->registerUser($username,$email,$password,"standard"); 
if(!$success){
  echo $register->getMessage();
}

Frontend

There is an optional UI included (see source). It's themable, but here's some screenshots of it running...

Log-in Screen

Verification Screen

Account Settings Screen

Profile Screen


Contributing

Contributions are welcome :)

Changes can be submitted by opening a pull request - if you're new to GitHub, see the documentation for a step-by-step guide on how to submit edits to projects. All submissions must abide by the Contributor Covenant Code of Conduct.


License

User Monkey is licensed under MIT Β© Alicia Sykes 2012-22.
For information, see TLDR Legal > MIT

Expand MIT License
The MIT License (MIT)
Copyright (c) Alicia Sykes <alicia@omg.com> 

Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights 
to use, copy, modify, merge, publish, distribute, sub-license, and/or sell 
copies of the Software, and to permit persons to whom the Software is furnished 
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included install 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANT ABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Β© Alicia Sykes 2012
Licensed under MIT

Thanks for visiting :)

About

πŸ’ A complete user system written in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published