Recommend this page to a friend! |
![]() |
Info | Example | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
![]() ![]() ![]() ![]() | Total: 8,734 | All time: 184 This week: 51![]() |
Version | License | PHP version | Categories | |||
php-secure-login 1.0.18 | The PHP License | 5 | PHP 5, Databases, User Management, Se..., P... |
Description | Author | |
This class can register and login users in a database with PDO. It can: |
|
Create database table
Database table to store login information
Secure login on Web site and database
My site has been hacked many times
<?php |
This class can register and login users in a database with PDO. It can:
A Secure PHP7 class for basic user login and registration.
Very easy to use as REST API, with AJAX and Bootstrap
PHP Tested: 5.6.19, 7.0.11
This PHP Secure Login class is available in the PHP Classes site
1. VARIABLE DEFINITIONS
2. ALL METHODS
2.1. User::dbConnect()
2.2. User::getUser()
2.3. User::login()
2.4. User::registration()
2.5. User::sendConfirmationEmail()
2.6. User::emailActivation()
2.7. User::passwordChange()
2.8. User::assignRole()
2.9. User::userUpdate()
2.10. User::checkEmail()
2.11. User::registerWrongLoginAttemp()
2.12. User::hashPass()
2.13. User::printMsg()
2.14. User::logout()
2.15. User::listUsers()
2.16. User::render()
2.17. User::indexHead(), User::indexTop(), User::loginForm(), User::activationForm(), User::indexMiddle(), User::registerForm(), User::indexFooter(), User::userPage()
Variable definitions provided in the beginning of the class:
/ @var object $pdo Copy of PDO connection */
private $pdo;
/ @var object of the logged in user */
private $user;
/ @var string error msg */
private $msg;
/ @var int number of permitted wrong login attemps */
private $permitedAttemps = 5;
Connection init function.
$conString DB connection string. $user DB user. $pass DB password.
Return the logged in user.
Login function.
$email User email. $password User password.
Register a new user account function
$email User email. $fname User first name. $lname User last name. $pass User password.
Email the confirmation code function.
$email User email.
Activate a login by a confirmation code function.
$email User email. $confCode Confirmation code.
Password change function.
$id User id. $pass New password.
Assign a role function.
$id User id. $role User role.
User information change function.
$id User id. $fname User first name. $lname User last name.
Check if email is already used function.
$email User email.
Register a wrong login attemp function.
$email User email.
Password hash function.
$password User password.
Print error msg function.
Logout the user and remove it from the session.
Returns an array of all available users in the DB.
Simple template rendering function $path path of the template file.
Template functions depending on a config file to show different parts of HTML in the examples.
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
95% |
|
|
User Ratings | User Comments (4) | |||||||||||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.