Skip to content

angryera/AFD

Repository files navigation

codeigniter-reg-login

How to create a login & registration system in Codeigniter

Codeigniter version: 3.1.6

After you download unzip the code into your xampp or wampp and rename the folder to codeigniter and then do the below configurations first.

Open and edit /codeigniter/application/config/config.php

$config['base_url'] = 'http://localhost/codeigniter/index.php';

then,

update your database settings in /codeigniter/application/config/database.php

$db['default'] = array(
	'dsn'	=> '',
	'hostname' => 'localhost',
	'username' => 'root',
	'password' => '',
	'database' => 'codeigniter',
	'dbdriver' => 'mysqli',
	'dbprefix' => '',
	'pconnect' => FALSE,
	'db_debug' => (ENVIRONMENT !== 'production'),
	'cache_on' => FALSE,
	'cachedir' => '',
	'char_set' => 'utf8',
	'dbcollat' => 'utf8_general_ci',
	'swap_pre' => '',
	'encrypt' => FALSE,
	'compress' => FALSE,
	'stricton' => FALSE,
	'failover' => array(),
	'save_queries' => TRUE
);

Now open phpmyadmin / mysql, and create a new database called 'codeigniter' and execute the below queries:

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `user_id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `password` varchar(50) NOT NULL,
  `date_time` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`user_id`);

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;

This will create a new table in your database called 'users'.

Basic configuration are done now.

Run your application to see the application is working.

You can also refer the tutorial here at: http://theonlytutorials.com/codeigniter-login-and-registration-tutorial/

Demo is available at: http://theonlytutorials.com/demo/codeigniter3-login/index.php/#

Thanks!

Releases

No releases published

Packages

No packages published