Skip to content
pakainfo

Pakainfo

Web Development & Good Online education

  • Home
  • Blog
  • Categories
  • Tools
  • Full Form
  • Guest Post
  • Advertise
  • About
  • Contact Us

CodeIgniter Simple User Registration and Login System

May 25, 2019 Pakainfo Programming, Codeigniter, Mysql, Mysqli Leave a comment

CodeIgniter Simple User Registration and Login System

Contents

  • CodeIgniter Simple User Registration and Login System
    • autoload.php
    • config.php
    • Table students
    • Controllers – main.php
    • Models – main_model.php
    • Views – login.php
    • Related posts

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!.

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

Also Read This πŸ‘‰   PHP Multidimensional Array Check if specific array key

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 posts:

  1. Angular 6 – User Registration and Login Example & Tutorial
  2. Vue.js Simple Login Script using PHP MySQLi Bootstrap
codeigniter – login registration form code free downloadcodeigniter 3 logincodeigniter login and access management systemcodeigniter login and registration with sessioncodeigniter simple login systemhow to create login form in codeigniterstudent registration form in codeigniteruser registration form in codeigniter

Post navigation

Previous Post:Image Resize Crop Thumbnail Watermark PHP Script
Next Post:Difference Between CSV and XLS file Formats

Advertise With Us

Increase visibility and sales with advertising. Let us promote you online.
Click Here

Write For Us

We’re accepting well-written informative guest posts and this is a great opportunity to collaborate.
Submit a guest post to [email protected]
Contact Us

Freelance web developer

Do you want to build a modern, lightweight, responsive website quickly?
Need a Website Or Web Application Contact : [email protected]
Note: Paid Service
Contact Me

Categories

3movierulz (64) Ajax (464) AngularJS (377) ASP.NET (61) Bio (109) Bollywood (108) Codeigniter (175) CSS (98) Earn Money (92) Education (61) Entertainment (130) fullform (86) Google Adsense (63) Highcharts (77) History (40) Hollywood (109) JavaScript (1359) Jobs (42) jQuery (1423) Laravel (1088) LifeStyle (53) movierulz4 (63) Mysql (1032) Mysqli (891) php (2127) Programming (2338) Python (98) Software (169) Software (88) Stories (98) tamilrockers (104) Tamilrockers kannada (64) Tamilrockers telugu (61) Tech (145) Technology (2395) Tips and Tricks (121) Tools (209) Top10 (488) Trading (92) Trending (72) VueJs (250) Web Technology (106) webtools (192) wordpress (166) World (332)

A To Z Full Forms

Access a complete full forms list with the meaning, definition, and example of the acronym or abbreviation.
Click Here
  • Home
  • About Us
  • Terms And Conditions
  • Write For Us
  • Advertise
  • Contact Us
  • Youtube Tag Extractor
  • Info Grepper
  • Guest Posting Sites
  • Increase Domain Authority
  • Social Media Marketing
  • Freelance web developer
  • Tools
Pakainfo 9-OLD, Ganesh Sco, Kothariya Ring Road, Chokadi, Rajkot - 360002 India
E-mail : [email protected]
Pakainfo

Β© 2023 Pakainfo. All rights reserved.

Top
Subscribe On YouTube : Download Source Code
We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype Guest Posting Sites