A complete web sample and template of a secure authentication system using the Codeigniter PHP framework. Very simple configuration, as most of it has been done in this sample.
PHP version 5.1.6 or newer.
Updated to CodeIgniter 2.1.0
- Cross-site request forgery protection (CSRF)
- Protects against cross-site scripting (XSS)
- Encrypted Cookies and sessions are securely stored in the database
- Utilizes query bindings and active records -- all queries are escaped
- Site is divided into three sections: normal pages, secure pages, and admin pages
- Windows 8 Developer Preview 8102 will have problems logging in
- Remember me cookies/persistent login deliberately left out, message me for the code if you would like it
- Unzip package
- Upload entire folders to server
- Create a database on your server, import envysea.sql (phpMyAdmin)
- Go to application/config/config.php
- Change $config['base_url'] to your base URL
- Change $config['encryption_key'] to a completely random character string (random means random -- uppercase, lowercase, number, symbol, etc. and do not leave it as the current value)
- Go to application/config/envysea.php and make all changes between the comment blocks
- Open application/config/database.php and enter your database paramters (username, password, database)
- Open site and enjoy
There are two users by default - username: "admindude", password: "admindude" and username: "normaldude", password: "normaldude" - We are going to delete both of them and create your own separate to your site
- Delete all users from database
- Open application/config/envysea.php, change "salty_salt" and "admin_level" to a random character string unique to your site
- Go to the webpage, and create two new users
- Go into your database and change the user_level of the user you want to be an admin to equal your new admin_level
- You are now 100% done with the installation and have a fully featured membership site unique and secure to you
The "module" variable is just a way for you to distinguish which header and footer you want to use when loading views:
- Use the envysea module when loading views for all normal access websites
- Use the secure module when loading views for all secure pages
- Use the admin module when loading views for all admin pages
The construct of controllers require:
- Nothing (no code) for normal pages
- $this->auth->is_logged_in() for secure pages
- $this->auth->is_logged_in() and $this->auth->is_admin() for admin pages
Auth Library
- The create function in the auth library is shared between the normal user registration and the admin create a person views
- The update function in the auth library is shared between the normal user account update and the admin update a person views
- The delete function in the auth library is shared between the normal user account delete and the admin update a person views
Feel free to email me at [email protected] for questions or help. Unfortunately the rest of this documentation will have to be continued at a later