Delivering the best Add-Ons in more than 37 languages.

中文(简体), English, हिन्दी/हिंदी, Español/Castellano, العربية, Русский язык, Français, 中文 (台灣), বাংলা, Bahasa Indonesia, اردو, Português, Deutsch, Bahasa Melayu (بهاس ملايو‎), 日本語 (にほんご), فارسی, Italiano, తెలుగు, Türkçe, ગુજરાતી, Język polski/polszczyzna, Tiếng Việt, ಕನ್ನಡ, Українська мова, ไทย
PHP Scripts / Miscellaneous

SAFE The Login Class

— Add-On to

Subscribe to our feed to stay up to date!

New! Follow us as you want it!

SAFE The Login Class - CodeCanyon Item for Sale


Ad: Bluehost hosting

Version 4 is out! Completly Refactored and more stable

New Feature in v3.3: Bcrypt Password Hashing

We all know this: Your just writing a simple to script 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 a 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.php All 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 logout()

The theme for the login form is based on Twitter Bootstrap and uses the Bootstrap CDN ( 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’!

Other components in this categoryAll components of this author
CommentsFrequently asked questions and answers


12 March 13

Last Update:
11 November 13

High Resolution:

Files Included:

Software Version:
PHP 5.3, PHP 5.4, PHP 5.5, MySQL 5.x


eCommerce, eCommerce, All Items, auth, authentication, bcrypt, class, hash, login, loginsystem, php, script