Skip to content
  • Home
  • Server-Side
    • php
    • Node.js
    • ASP.NET
    • Magento
    • Codeigniter
    • Laravel
    • Yii
    • CRUD
      • CRUD Database Application
      • CRUD operation in Client side
      • CRUD operation with server side
  • JavaScript
    • AngularJS
    • Ajax
    • VueJs
    • jQuery
    • ReactJS
    • JavaScript
    • SEO
  • Programming
    • Android
    • C programming
    • CSS
    • Mysql
    • Mysqli
  • Technology
    • Software
      • webinar software
      • webinar conferencing software
      • soundproof
    • Adsense
      • Google
      • Earn Money
      • Google Adsense
        • Adsense fraud
        • Adsense Secrets
        • Adsense software
        • Adwords advice
        • Adwords strategy
        • Google adwords help
        • How to get google ads
    • Tips and Tricks
    • Interview
    • Insurance
    • Religious
    • Entertainment
      • Bollywood
      • tamilrockers
      • Hollywood
  • Health Care
    • LifeStyle
    • Women
    • Fashion
    • Top10
    • Jobs
  • Tools
    • Screen Resolution
    • WORD COUNTER
    • Online Text Case Converter
    • what is my screen resolution?
  • Guest Post
    • 4cgandhi
    • IFSC Code

CodeIgniter Simple User Registration and Login System

August 18, 2019May 25, 2019 by Pakainfo

CodeIgniter Simple User Registration and Login System

In this Post We Will Explain About is CodeIgniter Simple User Registration and Login System With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Make Simple Login Form in CodeIgniter With Sessions Example

In this post we will show you Best way to implement CodeIgniter Simple Login Form With Sessions, hear for How to Create Login Form in CodeIgniter, MySQL and Twitter Bootstrap with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Read Also:  CodeIgniter Login Registration Example Tutorial From Scratch

autoload.php

   

config.php

  

Table: students

--  
 -- Table structure for table `students`  
 --  
 CREATE TABLE IF NOT EXISTS `students` (  
  `id` int(11) NOT NULL AUTO_INCREMENT,  
  `studentname` varchar(250) NOT NULL,  
  `password` varchar(250) NOT NULL,  
  PRIMARY KEY (`id`)  
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;  
 --  
 -- Dumping data for table `students`  
 --  
 INSERT INTO `students` (`id`, `studentname`, `password`) VALUES  
 (1, 'jaydeepGondaliya', '[email protected]#csom'); 

Controllers – main.php

load->view("login", $data);  
      }  
      function auth_validation_login()  
      {  
           $this->load->library('form_validation');  
           $this->form_validation->set_rules('studentname', 'StudentName', 'required');  
           $this->form_validation->set_rules('password', 'Password', 'required');  
           if($this->form_validation->run())  
           {  
                //live boolean value true  
                $studentname = $this->input->post('studentname');  
                $password = $this->input->post('password');  
                //codeigniter model function  
                $this->load->model('main_model');  
                if($this->main_model->stud_auth($studentname, $password))  
                {  
                     $session_data = array(  
                          'studentname'     =>     $studentname  
                     );  
                     $this->session->set_userdata($session_data);  
                     redirect(base_url() . 'main/enter');  
                }  
                else  
                {  
                     $this->session->set_flashdata('error', 'Invalid StudentName and Password');  
                     redirect(base_url() . 'main/login');  
                }  
           }  
           else  
           {  
                //boolean value false  
                $this->login();  
           }  
      }  
      function enter(){  
           if($this->session->userdata('studentname') != '')  
           {  
                echo '<h2>Welcome - '.$this->session->userdata('studentname').'</h2>';  
                echo '<label><a href="'.base_url

().'main/logout">Logout</a></label>';  
           }  
           else  
           {  
                redirect(base_url() . 'main/login');  
           }  
      }  
      function logout()  
      {  
           $this->session->unset_userdata('studentname');  
           redirect(base_url() . 'main/login');  
      }  
 } 

Models – main_model.php

db->where('studentname', $studentname);  
           $this->db->where('password', $password);  
           $query = $this->db->get('students');  
           //SELECT * FROM students WHERE studentname = '$studentname' AND password = '$password'  
           if($query->num_rows() > 0)  
           {  
                return true;  
           }  
           else  
           {  
                return false;       
           }  
      }  
 }  

Views – login.php

   
   
   
      <title>Pakainfo.com | </title>  
	  <!-- Devloped by Pakainfo.com free download examples -->
        
   
  
<!-- Devloped by Pakainfo.com free download examples --> 
      <div class="live container">  
           <hr />
           <form method="post" action="main/auth_validation_login">  
                <div class="form-group">  
                     <label>Enter StudentName</label>  
                       
                     <span class="text-danger"></span>                 
                </div>  
                <div class="live form-group">  
                     <label>Enter Student Password</label>  
                       
                     <span class="text-danger"></span>  
                </div>  
                <div class="live form-group">  
                       
                     <?php  
                          echo '<label class="live text-danger">'.$this->session->flashdata

("error").'</label>';  
                     ?>  
<!-- Devloped by Pakainfo.com free download examples -->
                </div>  
           </form>  
      </div>  
   
 

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Read Also:  tellraw generator minecraft bedrock - Command List

Example

I hope you have Got What is php – Login system with session using CodeIgniter And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Vuejs Autocomplete Input Tags component
  2. Read Also:  Laravel Highcharts Tutorial Example From Scratch
  3. Read Also:  PHP Laravel Paths Example Tutorial From Scratch
  4. Read Also:  how to create bar chart in php and mysql Example?
  5. Read Also:  open link in new tab react Example Tutorial
  6. Read Also:  Complete User Registration system using Codeigniter 3
  7. Read Also:  Laravel 6 Advanced Subqueries Examples
  8. Read Also:  Jquery check if value exists in Array Example
  9. Read Also:  Calculate days between two dates in jquery
  10. Read Also:  install node on windows
Categories Codeigniter, Mysql, Mysqli, Programming Tags codeigniter – login registration form code free download, codeigniter 3 login, codeigniter login and access management system, codeigniter login and registration with session, codeigniter simple login system, how to create login form in codeigniter, student registration form in codeigniter, user registration form in codeigniter
Post navigation
Image Resize Crop Thumbnail Watermark PHP Script
Difference Between CSV and XLS file Formats

Categories

Ajax (415) AngularJS (357) ASP.NET (61) Bollywood (34) Business (16) Codeigniter (141) C programming (13) CSS (62) Earn Money (50) Education (30) Entertainment (40) Events (14) Google Adsense (58) Government (13) Highcharts (77) Hollywood (33) Interview (18) JavaScript (854) Jobs (25) jQuery (931) Laravel (998) LifeStyle (30) linux (18) Magento (13) Mysql (865) Mysqli (773) Node.js (34) php (1671) Programming (2171) Python (44) ReactJS (33) SEO (22) Software (16) Software (38) tamilrockers (29) Tech (15) Technology (2179) Tips and Tricks (75) Tools (27) Top10 (109) VueJs (249) Web Technology (28) wordpress (135) World (22) Yii (14)
© 2021 Pakainfo • Developed By Pakainfo.com