Skip to content

jeevan15498/CodeIgniter-4---Login-and-Registration-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeIgniter 4 - Login and Registration System

CSS Library

Routes

  • {$base_url}/
  • {$base_url}/user/registration
  • {$base_url}/user/login

Changelog

  • Setup CodeIgniter 4 Folder in your local Server

  • Enable .env File

  • Change ENVIRONMENT Type production to development

  • Update Base URL, Time Zone (Asia/Kolkata), Set Debug Toolbar Status

  • Create a new controller Users.php and insert basic code

  • Create user login and registration routes and controller method

  • Create user login and registration views file in the /Views Folder

    • app\Views\users\user_login.php
    • app\Views\users\user_registration.php
  • Create header, nav, footer files in the /Views Folder

    • app\Views\component\header.php
    • app\Views\component\nav.php
    • app\Views\component\footer.php
  • Integrate Bootstrap 4 in the header.php file

  • Include header, footer in the Controller Methods.

  • Integrate Page Title in the header and Controller File.

  • Create user_registration and user_login templates with bootstrap 4 code.

  • What user information do you want to get?

    • first_name
    • last_name
    • mobile
    • email
    • username
    • password
    • confirm_password
  • Introduction CodeIgniter 4 - POST and GET Request

  • If user data showing in the post method then integrate form validation.

    <?= $validation->listErrors() ?>
  • Set Value method in the form input fields

  • If all user data fetch in the user controller then create users database table

    CREATE TABLE `users` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `first_name` varchar(200) NOT NULL,
        `last_name` varchar(200) NOT NULL,
        `mobile` varchar(10) NOT NULL,
        `email` varchar(250) NOT NULL,
        `username` varchar(250) NOT NULL,
        `password` text NOT NULL,
        `created_at` varchar(50) NOT NULL,
        `updated_at` varchar(50) NOT NULL,
        `deleted_at` varchar(50) NOT NULL,
        PRIMARY KEY (`id`),
        UNIQUE KEY `email` (`email`),
        UNIQUE KEY `username` (`username`)
    ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4
  • Integrate database in the project .env file

  • Integrate UserModel.php in the user controller file

  • Set Timezone Asia/Kolkata in the App.php config file

    • and set project base url
  • Set before_insert and before_update methods in the user model file

  • If user data successful saved in the database then use flash session message

  • Use redirect function

  • Create user login system

    • Define name for route and use route name in the redirect method
  • Create User Dashboard Controller and create dashboard view file

    session()->get("AUTH.first_name");
    session()->get("AUTH.last_name";
  • Create User Logout Method

  • Next Topic: Protecting Routes without login users

  • Create a new Filter file app/Filters/AuthFilter.php

  • Include AuthFilter.php File into app/Config/Filters.php and app/Config/Routes.php Files

About

CodeIgniter 4 - Login and Registration System

Topics

Resources

License

Stars

Watchers

Forks

Languages