Version 4 is out! Completly Refactored and more stable
New Feature in v3.3: Bcrypt Password Hashing
We all know this: You’re just writing a simple script to speed things up or to have a fancy GUI for some tasks. You want to have control over your stuff from everywhere you are. Often the problem is that you have to write an auth-system as well and this can get boring and need a bit of time. To do it once is ok, but what if you have to do this a second time or third? Often you cannot just copy the files, because the links would be broken or whatever…The solution is a very simple but still customizable login class. This script has one essential script
SAFE.phpAll you have to do in order to protect your site is one line of code:
<?php require 'SAFE.php'; SAFE::quickSecure($_POST['password'], 'your_password'); ?>
For all features and modes please have look at the LivePreview which is also the documentation. The password is ‘demo’.
In Version 3.2 we added a lot of new functions and features.
The biggest change is here the database support!
The script can now get all users from a database.
Since this script is using the PDO to connect to the database.
You have to create a table in the database by executing a SQL command, which cam be found in the documentation.
All you have to do to register a new user is to run a specific function and append
?register to the URL in a future version their will be an GUI to do this.
The next new thing is the single usermode with username and password prompt
The database-enabled mode uses the PHP Data Object (PDO) and is protected against any kind of SQL injection. Cookies are validated with an extra sql table and unique tokens.
If you want to be super fancy and don’ t wanna change the password on every site you use with this script you can create a file e.g. ‘login-ctrl.php’ and type the lines above in and include only this file.
To logout simple append
?logout to a url where the class is implemented or call the function
The theme for the login form is based on Twitter Bootstrap and uses the Bootstrap CDN (bootstrapcdn.com) for serving the css.
And that’s it for now. Very easy to use and customizable. Stay tuned for future free updates and multiuser support.
The password for the demo is ‘demo’!