Google Ads

Secure Registration and Login Script with PHP and MySQL using CodeIgniter and Ion Auth PHP Script


Secure Registration and Login Script with PHP and MySQL using CodeIgniter and Ion Auth PHP Script

This is a secure registration and login form created using CodeIgniter and Ion Auth.

I highly recommend using Ion Auth to secure the login form of your site as this is already tested and proven to prevent SQL Injection.

In addition, I use Bootstrap to improve the design of the form.

Here’s the instruction on how to setup CodeIgniter, Ion Auth and Bootstrap.

1. Download CodeIgniter

  • Extract the files to your server. Example if you’re using XAMPP, extract it to D:\xampp\htdocs

2. Download Ion Auth

  • Extract the files under application folder. Example if you extract CodeIgniter in D:\xampp\htdocs\ci-ionauth-reg then extract Ion Auth under D:\xampp\htdocs\ci-ionauth-reg\application

3. Download Bootstrap

  • Extract Bootstrap under D:\xampp\htdocs\ci-ionauth-reg. You can choose to create another folder as long as it is relative to the path of the CodeIgniter file. Example, extract the folder under D:\xampp\htdocs\ci-ionauth-reg\assets or D:\xampp\htdocs\ci-ionauth-reg\bootstrap.

Configure CodeIgniter and Ion Auth

Before we configure CodeIgniter, first import the SQL file included with Ion Auth.

Open phpMyAdmin as follows:

http://localhost/phpmyadmin/

Create a database name loginreg (short for login and registration).
Click Import tab and browse the file located under D:\xampp\htdocs\ci-ionauth-reg\application\sql. Choose the file named ion_auth.sql if you’re using MySQL as your database.

Open config.php under D:\xampp\htdocs\ci-ionauth-reg\application\config folder. Change the following info into:

  1. $config[‘base_url’] = ‘http://localhost:8080/ci-ionauth-reg’;
  2. $config[‘index_page’] = ”;

Open database.php under D:\xampp\htdocs\ci-ionauth-reg\application\config folder. Change the following info into:

  1. ‘hostname’ => ‘localhost’,
  2. ‘username’ => ‘root’,
  3. ‘password’ => ”,
  4. ‘database’ => ‘loginreg’,

Note: I just change some few lines of code of Auth.php under controllers folder like:

  1. $this->_render_page(‘header_view’, $this->data);
  2. $this->_render_page(‘auth/login’, $this->data);
  3. $this->_render_page(‘footer_view’, $this->data);

header_view and footer_view includes the code to include Bootstrap file.

To open the login form and registration form, visit the following URLs:

http://localhost/ci-ionauth-reg/auth/login
http://localhost/ci-ionauth-reg/auth/create_user

Username: [email protected]
Password: password

You can also change the registration URL from http://localhost/ci-ionauth-reg/auth/create_user to http://localhost/ci-ionauth-reg/register by setting the routes.

Example, open routes.php under config folder.

$route['register'] = 'auth/create_user';

You can add the line after

$route['default_controller'] = 'welcome';

If you have any question, don’t hesitate to as under the comments below.

 

 


Related Post

PHPfox v3.4.0 RC 1 PHP Script Download PHPfox v3.4.0 RC 1 PHP Script Download Create a beautiful Social Network like Facebook, Twitter, Myspace etc. This is a popular PHP Script in th...
Amazon S3 – Droppy online file sharing PHP S... Amazon S3 - Droppy online file sharingAmazon S3 - Droppy online file sharingThe Amazon S3 plugin will connect your existing or new Droppy setup to you...
Social Networking Code v3 PHP Script Social Networking Code v3 PHP Script This code is written is php. You can share comments on your friends wall, upload photo, chating.   ...
Online Public Access Catalog (OPAC) PHP Script Online Public Access Catalog (OPAC) PHP Script This is a modified version of Online Public Access Catalog. The code is totally different from the p...
Puerto – Responsive Flat Buttons PHP Script ... Puerto - Responsive Flat ButtonsPuerto - Responsive Flat ButtonsPuerto – Responsive Flat Buttons: is pure HTML5/CSS3 flat buttons. Buttons has HTML5...

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *